Graph.adjacencyList

Get the adjacencyList of this graph where nodes are represented by their index in the nodes list.

struct Graph(Node, Weight = void, Flag!"isDirected" isDirected = No.isDirected, EdgePayload = void)
size_t[][]
adjacencyList
const
(
)

Examples

1 auto g1 = Graph!int([1, 2, 3, 4]);
2 
3 g1 ~= g1.edge(1, 1);
4 g1 ~= g1.edge(1, 2);
5 g1 ~= g1.edge(2, 2);
6 g1 ~= g1.edge(2, 3);
7 g1 ~= g1.edge(2, 4);
8 g1 ~= g1.edge(3, 4);
9 
10 assert(g1.adjacencyList() == [
11     [0, 1],
12     [0, 1, 2, 3],
13     [1, 3],
14     [1, 2],
15 ]);

Meta