Skip to content
GraphOutDegree

GraphOutDegree

Description

Number of outgoing neighbors for a node. Includes edges marked for removal but not yet committed.

Parameters

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

Success

Returns the out-degree as a u64. The graph is not modified.

Failure

Does not return - aborts via LOG_FATAL for an invalid or stale node id (caller bug).

Usage example (Cross-references)

Usage examples (Cross-references)
        result = result && GraphNodeGetId(node_b) == b;
        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 && (GraphEdgeCount(&graph) == 1);
        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, b, 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 && GraphHasEdge(&graph, a, b);
        result      = result && !GraphHasEdge(&graph, a, c);
        result      = result && (GraphOutDegree(&graph, a) == 1);
        result      = result && (GraphInDegree(&graph, b) == 1);
        result      = result && (GraphInDegree(&graph, c) == 0);
    
        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 && (GraphCommitChanges(&graph) == 1);
        result      = result && (GraphEdgeCount(&graph) == 0);
        result      = result && (GraphOutDegree(&graph, a) == 0);
        result      = result && (GraphInDegree(&graph, a) == 0);
        result      = result && (GraphNodeCount(&graph) == 3);
        result      = result && (GraphEdgeCount(&graph) == 0);
        result      = result && (GraphOutDegree(&graph, a) == 0);
        result      = result && (GraphOutDegree(&graph, d) == 0);
        result      = result && (GraphInDegree(&graph, c) == 0);
        result      = result && (GraphEdgeCount(&graph) == 0);
        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 && !GraphAddEdge(&graph, a, b);
        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 && !GraphAddEdge(&graph, a, a);
        result      = result && (GraphEdgeCount(&graph) == 3);
        result      = result && (GraphOutDegree(&graph, a) == 1);
        result      = result && (GraphInDegree(&graph, a) == 3);
        result      = result && (GraphNeighborAt(&graph, a, 0) == a);
Last updated on