A Flutter-based interactive graph visualization and visual programming tool designed to help learn and understand graph algorithms through hands-on exploration.
Overview
Graphy is an educational application that combines graph theory with visual programming. It provides a split-screen interface where users can create and manipulate graphs while simultaneously building custom algorithms using a node-based visual programming system.
Features
Interactive Graph Editor
- Visual Graph Creation: Create vertices and edges with intuitive mouse interactions
- Direct Manipulation: Click to create vertices, Shift+Click to connect them with edges
- Pan and Zoom: Interactive viewer with zoom (0.1x - 5x) and pan capabilities
- Delete Elements: Select and remove vertices or edges with keyboard shortcuts
- Color Visualization: Vertices and edges support color properties for algorithm visualization
Visual Programming Interface
- Node-Based Programming: Build custom graph algorithms using a visual programming paradigm
- Drag-and-Drop: Create programs by dragging and connecting logical nodes
- Real-Time Execution: Run programs directly on the graph data structure
- Connection Manager: Visual connection system with type checking and validation
Technical Architecture
Core Components
Graph System (lib/graph.dart)
Graph: Main data structure containing vertices and edges
Vertex: Graph nodes with position, color, and numbering
Edge: Connections between vertices with color properties
Colorable: Interface for visual styling
- Update notification system for real-time UI synchronization
Visual Programming (lib/visual_programmer/)
- Program: Execution engine for visual programs
- LogicalNode: Abstract interface for all visual programming nodes
- NodeManager: Manages node lifecycle and connections
- ConnectionManager: Handles connections between nodes
- ResourceManager: Provides access to graph data within programs
- Type System: Strong typing with support for generics and class hierarchies
UI Components (lib/ui/)
- Graph Screen: Interactive graph editor with transformation controls
- Programming Screen: Visual programming workspace
- Split Screen: Divides the interface between graph view and programming view
- Custom Widgets: Specialized widgets for vertices, nodes, and connections
Project Structure
lib/
├── algorithms/ # Graph algorithm implementations
│ └── dfs.dart # Depth-first search
├── ui/
│ ├── screens/ # Main application screens
│ └── widgets/ # Reusable UI components
├── utils/ # Utility classes (vectors, drag helpers, etc.)
├── visual_programmer/ # Visual programming system
│ └── nodes/ # Available programming nodes
├── algorithms.dart # Algorithm registry
├── graph.dart # Core graph data structures
└── main.dart # Application entry point
Getting Started
Prerequisites
- Flutter SDK (>=3.4.4 <4.0.0)
- Dart SDK
Installation
- Clone the repository
- Install dependencies:
flutter pub get
- Run the application:
flutter run
Usage
Creating a Graph
- Click anywhere in the Graph View to create a vertex
- Hold Shift and click another vertex to create an edge between them
- Click a vertex to select it
- Press Delete to remove the selected vertex
Building Visual Programs
- Right-click in the Programming View to open the node context menu
- Select and place nodes from the available categories
- Connect nodes by dragging from output to input connectors
- Use the Start node to access graph vertices and edges
- Build your algorithm logic using loops, conditionals, and data operations
Development
Key Design Patterns
- Observer Pattern: Update notifiers for reactive UI updates
- Strategy Pattern: Pluggable algorithm implementations
- Composite Pattern: Hierarchical node structure in visual programs
- Interface Segregation: Clean abstractions for
LogicalNode, Colorable, etc.
Extending the Project
Creating New Nodes
- Create a new file in
lib/visual_programmer/nodes/
- Implement the
LogicalNode interface
- Define input/output variables with appropriate types
- Implement the
generateSteps() method for program execution
Educational Purpose
Graphy is designed as a learning tool for:
- Understanding graph data structures
- Visualizing graph algorithms
- Learning visual programming concepts
- Exploring algorithm design through experimentation
Future Enhancements
Potential areas for expansion:
- Graph import/export functionality
- More programming nodes for complex operations
- Algorithm animation and step-by-step execution
- Tutorial system for beginners
- Save/load graph and program configurations
License
This project is a personal / educational project.
Author
Lukas