graph/graph_utils library

Graph representation helpers: adjacency list / weighted edges (roadmap #531).

Classes

GraphUtils
Weighted directed edge.

Functions

buildGraph(List<(int, int)> edges, int nodeCount) Adjacency
Builds an unweighted Adjacency list from edges, where nodeCount is the max node index + 1. Edges referencing out-of-range nodes are skipped.
buildWeightedGraph(List<GraphUtils> edges, int nodeCount) WeightedAdjacency
Builds WeightedAdjacency from edges; nodeCount = max node index + 1.

Typedefs

Adjacency = List<List<int>>
Unweighted: list of neighbors per node.
WeightedAdjacency = List<List<(int, double)>>
Adjacency list: for each node, list of (neighbor, weight).