Graph.indexOf

Returns the index of node n in the list of nodes.

  1. size_t indexOf(in Node n)
    struct Graph(Node, Weight = void, Flag!"isDirected" isDirected = No.isDirected, EdgePayload = void)
    size_t
    indexOf
    const
    (
    in Node n
    )
  2. size_t indexOf(in Edge edge)

Examples

1 auto g1 = Graph!(int, int)([1, 2]);
2 
3 assert(g1.indexOf(1) == 0);
4 assert(g1.indexOf(2) == 1);
5 assertThrown!MissingNodeException(g1.indexOf(3));

Meta