graph/graph_serialize_utils library

Compact text serialization for adjacency-list graphs — roadmap #554.

Encodes a directed Adjacency graph as a single line of text and decodes it back, with no dependency on dart:convert or any JSON library. The format is deliberately compact and human-readable for logs, snapshots, and test fixtures: each node is index>neighbor,neighbor,..., nodes are joined by ;, and a node with no out-edges is just its index. For example the graph 0 -> 1, 0 -> 2, 2 -> 0 serializes to 0>1,2;1;2>0.

The round trip is loss-free for any non-negative-indexed graph: neighbor order within a node is preserved, and isolated trailing nodes survive because every node index appears explicitly.

Functions

parseAdjacency(String text) Adjacency
Parses the compact text form produced by serializeAdjacency back into an Adjacency list sized to maxNodeIndex + 1.
serializeAdjacency(Adjacency graph) String
Serializes graph to the compact index>n,n;index>n text form.