How actbit/graphvisualizer works
Main Components
• Frontend/UI Layer: Represented by the GraphVisualizer directory. This layer includes:
⁃ Razor pages/components (e.g., App.razor, MainLayout.razor, various Pages like Home.razor, Graph.razor) that build the UI.
⁃ Static client-side assets (in wwwroot) such as CSS files, JavaScript files (including graph.js and cytoscape scripts), and service-worker files.
⁃ Services (e.g., ScriptLoaderService.cs) that handle client-side scripts and possibly asynchronous operations.
• Domain/Business Logic Layer: Represented by GraphLibrary.
⁃ Core classes such as Node.cs, Edge.cs, and GraphAction.cs. This is the backbone of the graph data model and processing of algorithms.
• Code-Compilation/Execution Component: Within GraphVisualizer there is Compiler.cs and other classes (like CodeChange.cs and InObject.cs) that seem responsible for compiling/executing user-defined algorithms written in C#, then linking back to the GraphLibrary.
• External Libraries & Integrations:
⁃ cytoscape.js (in wwwroot/cytoscape): Handles visual rendering of graphs.
⁃ ZstdSharp and dotnet: Providing compression and other runtime utilities.
• Persistence/URL Sharing: The README describes that graph data and code are saved within a generated URL, so include a component to represent the URL-based state persistence and sharing mechanism.
Representing Interactions and Data Flow
• That users interact with the UI (via the web browser) where operations such as node/edge additions, deletions, and algorithm script entry occur.
• The UI layer triggers calls to domain logic in GraphLibrary classes (for example, when a user adds a node or runs an algorithm).
• Demonstrate how the Compiler.cs processes and hands off the user’s submitted C# code (derived from GraphAction) to execute algorithmic steps.
• Integration of external libraries – for example, cytoscape.js receiving data from GraphLibrary and rendering the interactive graph.
• That the URL generation component takes the current state and encodes it for later retrieval.
Architectural Patterns & Design Principles
• The separation of concerns is evident: UI (presentation) is cleanly separated from the domain logic (GraphLibrary).
• The system employs an MVC/MVVM-like approach by isolating user interactions (views and services) from business logic and graph manipulations.
• There is an element of extensibility since users can write or modify algorithm code that extends the abstract GraphAction class.