Report a bug
If you spot a problem with this page, click here to create a Github issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.


Basic routines to work with graphs.
Ilya Yaroshenko
template GraphIterator(I = uint, J = size_t)
template Graph(I = uint, J = size_t)
template GraphSeries(T, I = uint, J = size_t)
GraphSeries!(T, I, J) graphSeries(I = uint, J = size_t, T, Range)(in Range[T] aaGraph);

Param aaGraph = graph that is represented as associative array

A graph series composed of keys (sorted .index) and arrays of indeces (.data)

Complexity O(log(V) (V + E))

auto gs = [
    "b" : ["a"],
    "a" : ["b", "c"],
    "c" : ["b"],

assert (gs.index == ["a", "b", "c"]); // sorted
assert ( == [
    [1, 2], // a
    [0],    // b
    [1],    // c