createSnapshot method

Builds a GraphVisualizationSnapshot for graph.

Implementation

GraphVisualizationSnapshot createSnapshot(ArchitectureGraph graph) {
  return GraphVisualizationSnapshot(
    mermaid: generateMermaid(graph),
    nodeCount: graph.nodes.length,
    edgeCount: graph.edges.length,
    cycleCount: graph.findCycles().length,
    logicUnitCount: graph.nodes.values.whereType<LogicUnitNode>().length,
    widgetCount: graph.nodes.values.whereType<WidgetNode>().length,
  );
}