A Windows Forms application for visualizing hierarchical graph structures with a custom canvas renderer.
This project has been converted from a Unity Editor extension to a standalone Windows Forms application. It provides an interactive graph visualization tool with support for:
- Hierarchical Node Structures: Display parent-child relationships in a tree layout
- Interactive Canvas: Pan and zoom with mouse controls
- Node Selection: Click nodes to view detailed properties
- Custom Rendering: High-performance double-buffered rendering with GDI+
- Color-coded nodes based on content type
- Connection lines showing parent-child relationships
- Grid background for spatial reference
- Node selection highlighting
- Weight indicators on nodes
- Active/inactive node states
- Mouse Wheel: Zoom in/out
- Middle Mouse Button: Pan the canvas
- Left Click: Select nodes
- Ctrl+N: Create new graph
- Ctrl+R: Reset view
- Main Canvas: Graph visualization area
- Properties Panel: Detailed node information display
- Menu Bar: File and View operations
- Status Bar: User guidance and feedback
- Graph.cs: Abstract base class for graph data structures
- Node.cs: Node representation with hierarchy support
- GraphCanvas.cs: Custom Windows Forms control for rendering graphs
- GraphVisualizerForm.cs: Main application window
- IGraphLayout.cs: Interface for layout algorithms
- SimpleTreeLayout: Basic tree layout implementation
- Vertex: Position and dimension data for nodes
- IGraphRenderer.cs: Abstraction for graph rendering
- GraphSettings: Configuration for visual appearance
- .NET 8.0 SDK or later
- Windows OS (Windows Forms dependency)
dotnet builddotnet runThe application includes a sample graph that loads automatically on startup. The sample demonstrates:
- Root node with multiple children
- Multi-level hierarchy (grandchildren)
- Different node weights
- Active and inactive nodes
Extend the Graph base class and implement:
protected abstract IEnumerable<Node> GetChildren(Node node);
protected abstract void Populate();Implement IGraphLayout interface:
public interface IGraphLayout
{
List<Vertex> vertices { get; }
void CalculateLayout(Graph graph);
}- UnityEngine
- UnityEditor
- Unity PlayableGraph APIs
- Unity Editor Window → Windows Forms Form
- Unity GUI → GDI+ Graphics
- UnityEngine.Color → System.Drawing.Color
- Unity Rect → System.Drawing.Rectangle
- Unity Vector2/Vector3 → System.Drawing.PointF
- Standalone executable (no Unity required)
- Enhanced mouse controls (pan/zoom)
- PropertyGrid integration for node inspection
- Modern dark theme UI
- No LiteGraph external library (using custom renderer instead)
- Some nullability warnings (benign, related to nullable reference types)
- Windows-only (Windows Forms dependency)
Potential improvements:
- Save/Load graph data
- Export to image formats
- Custom node styling
- Animation support
- Multi-graph comparison
- Search and filter capabilities
Same as original project.
Contributions welcome! Areas for improvement:
- Additional layout algorithms
- Performance optimizations
- Cross-platform support (consider Avalonia UI)
- More sample graphs