Skip to content

GraphEmpty

Description

Check whether graph contains no live nodes.

Parameters

Name Direction Description
g in Graph to query.

Success

Returns true when live_count == 0. The graph is not modified.

Failure

Returns false when the graph holds at least one live node.

Usage example (Cross-references)

Usage examples (Cross-references)
        *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;
        // are read directly here to verify the default-constructed graph has
        // every internal cursor / table empty.
        bool result = GraphNodeCount(&graph) == 0 && GraphEdgeCount(&graph) == 0 && GraphEmpty(&graph) &&
                      VecBegin(&graph.slots) == NULL && VecBegin(&graph.free_indices) == NULL &&
                      VecBegin(&graph.pending_edge_removals) == NULL && GraphCopyInit(&graph) == NULL &&
        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);
Last updated on