GraphNodeVisitCount
Description
Get the current scratch visit count for a node handle.
This count is graph-owned scratch state. It is convenient for simple traversals, but it is not a substitute for richer application-owned side tables.
Parameters
| Name | Direction | Description |
|---|---|---|
node |
in | GraphNode handle to query. |
Success
Current scratch visit count for the node.
Failure
Does not return on invalid node handle.
Usage example (Cross-references)
Usage examples (Cross-references)
static bool city_reachable_from(GraphNode node, GraphNodeId goal_id) {
if (GraphNodeVisitCount(node) > 0) {
return false;
} city_reset_visits(&graph);
GraphForeachNode(&graph, node) {
result = result && (GraphNodeVisitCount(node) == 0);
}- In
Graph.Ops.c:15:
GraphNode node = GraphGetNode(&graph, a);
bool result = !GraphNodeVisited(node) && (GraphNodeVisitCount(node) == 0);
GraphNodeVisit(node);- In
Graph.Ops.c:20:
GraphNodeVisit(node);
result = result && GraphNodeVisited(node) && (GraphNodeVisitCount(node) == 2);
GraphNodeUnvisit(node);- In
Graph.Ops.c:23:
GraphNodeUnvisit(node);
result = result && !GraphNodeVisited(node) && (GraphNodeVisitCount(node) == 0);
GraphDeinit(&graph);
Last updated on