Skip to content
GraphEdgeCount

GraphEdgeCount

Description

Number of directed edges currently stored in graph.

Parameters

Name Direction Description
g in Graph to query.

Success

Edge count.

Failure

Function cannot fail.

Usage example (Cross-references)

Usage examples (Cross-references)
        result = result && (removed == 1);
        result = result && (GraphNodeCount(&graph) == 2);
        result = result && (GraphEdgeCount(&graph) == 1);
        result = result && !GraphContainsNode(&graph, b);
        result = result && (GraphOutDegree(&graph, a) == 0);
        result = result && GraphHasEdge(&graph, a, c);
        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 && (GraphCommitChanges(&graph) == 0);
        result      = result && GraphHasEdge(&graph, a, b);
        result      = result && (GraphEdgeCount(&graph) == 1);
    
        GraphDeinit(&graph);
        result      = result && GraphMarkEdgeForRemoval(&graph, a, 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 && !GraphContainsNode(&graph, b);
        result      = result && (GraphNodeCount(&graph) == 3);
        result      = result && (GraphEdgeCount(&graph) == 0);
        result      = result && (GraphOutDegree(&graph, a) == 0);
        result      = result && (GraphOutDegree(&graph, d) == 0);
        GraphClear(&graph);
    
        result = result && GraphNodeCount(&graph) == 0 && GraphEdgeCount(&graph) == 0 && GraphEmpty(&graph);
        result = result && !GraphContainsNode(&graph, first_id) && !GraphContainsNode(&graph, second_id);
        result = result && !GraphContainsNode(&graph, third_id);
        ValidateGraph(&graph);
    
        bool result = GraphNodeCount(&graph) == 0 && GraphEdgeCount(&graph) == 0 && GraphEmpty(&graph) &&
                      graph.slots.data == NULL && graph.free_indices.data == NULL &&
                      graph.pending_edge_removals.data == NULL && graph.copy_init == NULL && graph.copy_deinit == NULL &&
        *GraphNodeDataPtr(&graph, node_b) = 25;
    
        bool result = GraphNodeCount(&graph) == 3 && GraphEdgeCount(&graph) == 3 && !GraphEmpty(&graph);
        result      = result && GraphContainsNode(&graph, a) && GraphContainsNode(&graph, b) && GraphContainsNode(&graph, c);
        result      = result && GraphNodeAt(&graph, b) == 25;
        result      = result && GraphAddEdge(&graph, a, c);
        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 && GraphAddEdge(&graph, c, a);
        result      = result && !GraphAddEdge(&graph, a, a);
        result      = result && (GraphEdgeCount(&graph) == 3);
        result      = result && (GraphOutDegree(&graph, a) == 1);
        result      = result && (GraphInDegree(&graph, a) == 3);
Last updated on