Skip to content

GraphInDegree

Description

Number of incoming neighbors for a node.

Parameters

Name Direction Description
g in Graph to query.
node_id in Node id whose in-degree is requested.

Success

In-degree of node.

Failure

Does not return on invalid node id.

Usage example (Cross-references)

Usage examples (Cross-references)
        bool result = (predecessor_count == 3);
        result      = result && (predecessor_sum == 6);
        result      = result && (GraphInDegree(&graph, d) == 3);
        result      = result && (GraphInDegree(&graph, a) == 0);
        result      = result && (predecessor_sum == 6);
        result      = result && (GraphInDegree(&graph, d) == 3);
        result      = result && (GraphInDegree(&graph, a) == 0);
    
        GraphDeinit(&graph);
        result = result && !GraphContainsNode(&graph, b);
        result = result && (GraphOutDegree(&graph, a) == 0);
        result = result && (GraphInDegree(&graph, a) == 1);
        result = result && (GraphInDegree(&graph, c) == 0);
        result = result && GraphHasEdge(&graph, c, a);
        result = result && (GraphOutDegree(&graph, a) == 0);
        result = result && (GraphInDegree(&graph, a) == 1);
        result = result && (GraphInDegree(&graph, c) == 0);
        result = result && GraphHasEdge(&graph, c, a);
        result = result && (GraphPredecessorAt(&graph, a, 0) == c);
        result = result && (GraphEdgeCount(&graph) == 1);
        result = result && (GraphOutDegree(&graph, a) == 1);
        result = result && (GraphInDegree(&graph, b) == 0);
        result = result && (GraphInDegree(&graph, c) == 1);
        result = result && (GraphNeighborAt(&graph, a, 0) == c);
        result = result && (GraphOutDegree(&graph, a) == 1);
        result = result && (GraphInDegree(&graph, b) == 0);
        result = result && (GraphInDegree(&graph, c) == 1);
        result = result && (GraphNeighborAt(&graph, a, 0) == c);
        result = result && (GraphPredecessorAt(&graph, c, 0) == a);
        result      = result && !GraphHasEdge(&graph, a, c);
        result      = result && (GraphOutDegree(&graph, a) == 1);
        result      = result && (GraphInDegree(&graph, b) == 1);
        result      = result && (GraphInDegree(&graph, c) == 0);
        result      = result && (GraphOutDegree(&graph, a) == 1);
        result      = result && (GraphInDegree(&graph, b) == 1);
        result      = result && (GraphInDegree(&graph, c) == 0);
    
        GraphDeinit(&graph);
        bool result = GraphAddEdge(&graph, a, a);
        result      = result && (GraphOutDegree(&graph, a) == 1);
        result      = result && (GraphInDegree(&graph, a) == 1);
        result      = result && (GraphNeighborAt(&graph, a, 0) == a);
        result      = result && (GraphPredecessorAt(&graph, a, 0) == a);
        result      = result && (GraphEdgeCount(&graph) == 0);
        result      = result && (GraphOutDegree(&graph, a) == 0);
        result      = result && (GraphInDegree(&graph, a) == 0);
    
        GraphDeinit(&graph);
        result      = result && (GraphOutDegree(&graph, a) == 0);
        result      = result && (GraphOutDegree(&graph, d) == 0);
        result      = result && (GraphInDegree(&graph, c) == 0);
        result      = result && (GraphInDegree(&graph, a) == 0);
        result      = result && (GraphInDegree(&graph, d) == 0);
        result      = result && (GraphOutDegree(&graph, d) == 0);
        result      = result && (GraphInDegree(&graph, c) == 0);
        result      = result && (GraphInDegree(&graph, a) == 0);
        result      = result && (GraphInDegree(&graph, d) == 0);
        result      = result && (GraphInDegree(&graph, c) == 0);
        result      = result && (GraphInDegree(&graph, a) == 0);
        result      = result && (GraphInDegree(&graph, d) == 0);
    
        GraphDeinit(&graph);
        result      = result && GraphNodeIndex(node_b) == GraphNodeIdIndex(b);
        result      = result && GraphOutDegree(&graph, a) == 2;
        result      = result && GraphInDegree(&graph, a) == 1;
        result      = result && GraphInDegree(&graph, b) == 1;
        result      = result && GraphInDegree(&graph, c) == 1;
        result      = result && GraphOutDegree(&graph, a) == 2;
        result      = result && GraphInDegree(&graph, a) == 1;
        result      = result && GraphInDegree(&graph, b) == 1;
        result      = result && GraphInDegree(&graph, c) == 1;
        result      = result && GraphNeighborAt(&graph, a, 0) == b && GraphNeighborAt(&graph, a, 1) == c;
        result      = result && GraphInDegree(&graph, a) == 1;
        result      = result && GraphInDegree(&graph, b) == 1;
        result      = result && GraphInDegree(&graph, c) == 1;
        result      = result && GraphNeighborAt(&graph, a, 0) == b && GraphNeighborAt(&graph, a, 1) == c;
        result      = result && GraphNeighborAt(&graph, c, 0) == a;
        result      = result && GraphEdgeCount(&graph) == 2;
        result      = result && GraphOutDegree(&graph, a) == 2;
        result      = result && GraphInDegree(&graph, a) == 0;
        result      = result && GraphInDegree(&graph, b) == 1;
        result      = result && GraphInDegree(&graph, c) == 1;
        result      = result && GraphOutDegree(&graph, a) == 2;
        result      = result && GraphInDegree(&graph, a) == 0;
        result      = result && GraphInDegree(&graph, b) == 1;
        result      = result && GraphInDegree(&graph, c) == 1;
        result      = result && GraphNeighborAt(&graph, a, 0) == b;
        result      = result && GraphInDegree(&graph, a) == 0;
        result      = result && GraphInDegree(&graph, b) == 1;
        result      = result && GraphInDegree(&graph, c) == 1;
        result      = result && GraphNeighborAt(&graph, a, 0) == b;
        result      = result && GraphNeighborAt(&graph, a, 1) == c;
        result      = result && (GraphEdgeCount(&graph) == 3);
        result      = result && (GraphOutDegree(&graph, a) == 1);
        result      = result && (GraphInDegree(&graph, a) == 3);
        result      = result && (GraphNeighborAt(&graph, a, 0) == a);
        result      = result && (GraphPredecessorAt(&graph, a, 0) == a);
Last updated on