Skip to content
GraphNodeVisit

GraphNodeVisit

Description

Increment the scratch visit count of a node.

This is intentionally simple shared scratch state. Use external Vec, Map, or domain-specific side tables when an algorithm needs more than one counter or bit.

Parameters

Name Direction Description
node in GraphNode handle to mark as visited.

Success

Returns the new visit count for the node (post-increment). Only the scratch counter on the referenced slot is modified; graph structure (live_count, edges, generations) is untouched.

Failure

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

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    u64 GraphNodeVisit(GraphNode node) {
        GenericGraph     *graph;
        GenericGraphSlot *slot;
        bool result = !GraphNodeVisited(node) && (GraphNodeVisitCount(node) == 0);
    
        GraphNodeVisit(node);
        GraphNodeVisit(node);
    
        GraphNodeVisit(node);
        GraphNodeVisit(node);
    
        result = result && GraphNodeVisited(node) && (GraphNodeVisitCount(node) == 2);
        (void)GraphMarkNodeForDeletion(node);
        (void)GraphCommitChanges(&graph);
        (void)GraphNodeVisit(node);
    
        GraphDeinit(&graph);
        result = result && GraphAddEdge(&graph, third_id, first_id);
        result = result && GraphAddEdge(&graph, third_id, third_id);
        result = result && (GraphNodeVisit(GraphGetNode(&graph, first_id)) == 1);
        result = result && GraphMarkNodeForDeletion(GraphGetNode(&graph, second_id));
        result = result && GraphMarkEdgeForRemoval(&graph, third_id, third_id);
        }
    
        GraphNodeVisit(node);
        if (GraphNodeGetId(node) == goal_id) {
            return true;
Last updated on