Graph.inDegree

Get the in/out degree of node n.

  1. size_t inDegree(Node n)
    struct Graph(Node, Weight = void, Flag!"isDirected" isDirected = No.isDirected, EdgePayload = void)
    size_t
    inDegree
    const nothrow pure
    (
    Node n
    )
  2. alias inDegree = degree
  3. size_t outDegree(Node n)

Examples

1 auto g1 = Graph!(int, void, Yes.isDirected)([1, 2, 3]);
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 
8 assert(g1.inDegree(1) == 1);
9 assert(g1.outDegree(1) == 2);
10 assert(g1.inDegree(2) == 2);
11 assert(g1.outDegree(2) == 2);
12 assert(g1.inDegree(3) == 1);
13 assert(g1.outDegree(3) == 0);

Meta