renderGraph method
Renders an adjacency list view of the concept graph.
Implementation
String renderGraph(ConceptualGraph graph) {
final buf = StringBuffer();
buf.writeln('── Conceptual Graph ─────────────────────────────');
buf.writeln(' Nodes: ${graph.nodeCount} | Edges: ${graph.edgeCount}');
buf.writeln();
for (final node in graph.getAllNodes().take(20)) {
buf.writeln(' [${node.id.substring(0, 8)}] "${node.concept.content}"');
for (final edge in node.edges.values.take(5)) {
final target = graph.getNode(edge.targetId);
final label = target?.concept.content ?? edge.targetId;
buf.writeln(
' ──${edge.relationshipType.name}(${edge.strength.toStringAsFixed(2)})──▶ '
'"$label"');
}
}
if (graph.nodeCount > 20) {
buf.writeln(' ... and ${graph.nodeCount - 20} more nodes');
}
return buf.toString();
}