Skip to content
GraphUnmarkEdgeForRemoval

GraphUnmarkEdgeForRemoval

Description

Remove a pending edge-removal mark before commit.

Parameters

Name Direction Description
g in,out Graph owning the edge.
from in Source node id.
to in Destination node id.

Success

Returns true. The removal mark on the matching edge entry has been cleared. edge_count is unchanged.

Failure

Returns false when the edge was not marked. The graph is not modified.

Usage example (Cross-references)

Usage examples (Cross-references)
        result      = result && GraphEdgeMarkedForRemoval(&graph, a, b);
        result      = result && !GraphMarkEdgeForRemoval(&graph, a, b);
        result      = result && GraphUnmarkEdgeForRemoval(&graph, a, b);
        result      = result && !GraphEdgeMarkedForRemoval(&graph, a, b);
        result      = result && !GraphUnmarkEdgeForRemoval(&graph, a, b);
        result      = result && GraphUnmarkEdgeForRemoval(&graph, a, b);
        result      = result && !GraphEdgeMarkedForRemoval(&graph, a, b);
        result      = result && !GraphUnmarkEdgeForRemoval(&graph, a, b);
        result      = result && (GraphCommitChanges(&graph) == 0);
        result      = result && GraphHasEdge(&graph, a, b);
        result      = result && GraphEdgeMarkedForRemoval(&graph, a, b);
        result      = result && GraphEdgeMarkedForRemoval(&graph, a, c);
        result      = result && GraphUnmarkEdgeForRemoval(&graph, a, b);
        result      = result && !GraphEdgeMarkedForRemoval(&graph, a, b);
        result      = result && GraphEdgeMarkedForRemoval(&graph, a, c);
    // false rather than aborting.
    static bool test_unmark_edge_stale_from_deadend(void) {
        WriteFmt("Testing GraphUnmarkEdgeForRemoval rejects a stale from id (should abort)\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        (void)GraphAddNodeR(&graph, 99); // reuse a's slot, a is now stale
    
        (void)GraphUnmarkEdgeForRemoval(&graph, a, b);
    
        GraphDeinit(&graph);
    // valid `from` with a stale `to` must abort.
    static bool test_unmark_edge_stale_to_deadend(void) {
        WriteFmt("Testing GraphUnmarkEdgeForRemoval rejects a stale to id (should abort)\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        (void)GraphAddNodeR(&graph, 99); // reuse b's slot, b is now stale
    
        (void)GraphUnmarkEdgeForRemoval(&graph, a, b);
    
        GraphDeinit(&graph);
Last updated on