Skip to content

GraphClear

Description

Remove all nodes and edges from the graph but keep allocated storage. Node payloads are deinitialized via the configured copy_deinit handler when present.

Parameters

Name Direction Description
g in,out Graph handle.

Success

Returns to the caller. live_count, edge_count, and the pending-delete count are now 0. Every node slot is marked free; every adjacency list is reset. When copy_deinit is configured it has been invoked on each previously-stored payload. The slot array and free-index array keep their allocated capacity.

Failure

Function cannot fail.

Usage example (Cross-references)

Usage examples (Cross-references)
    
    static bool test_graph_reserve_clear(void) {
        WriteFmt("Testing GraphReserve and GraphClear\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        result = result && GraphMarkEdgeForRemoval(&graph, third_id, third_id);
    
        GraphClear(&graph);
    
        result = result && GraphNodeCount(&graph) == 0 && GraphEdgeCount(&graph) == 0 && GraphEmpty(&graph);
Last updated on