GraphNodeAt
Description
Access node payload at given node id.
Parameters
| Name | Direction | Description |
|---|---|---|
g |
in | Graph to query. |
node_id |
in | Node id to access. |
Success
Returns the payload as a value of type GRAPH_NODE_TYPE(g). The graph is not modified.
Failure
Does not return - aborts via LOG_FATAL for an invalid or stale node id (caller bug).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Ops.c:309:
result = result && (counts[GraphNodeIdIndex(reused)] == 0);
result = result && (counts[GraphNodeIdIndex(a)] == 11);
result = result && (GraphNodeAt(&graph, reused) == 99);
GraphDeinit(&graph);- In
Insert.c:46:
bool result = GraphNodeIdIndex(id0) == 0 && GraphNodeIdGeneration(id0) == 1 && GraphNodeIdIndex(id1) == 1;
result = result && owned == 0 && shared == 7;
result = result && GraphNodeAt(&graph, id0) == 42;
result = result && GraphNodeAt(&graph, id1) == 7;- In
Insert.c:47:
result = result && owned == 0 && shared == 7;
result = result && GraphNodeAt(&graph, id0) == 42;
result = result && GraphNodeAt(&graph, id1) == 7;
GraphDeinit(&graph);- In
Insert.c:198:
bool result = (failed_id == 0);
result = result && (GraphNodeIdIndex(reused) == GraphNodeIdIndex(b));
result = result && (GraphNodeAt(&graph, reused) == 40);
result = result && (GraphNodeCount(&graph) == 2);- In
Access.c:39:
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;
result = result && GraphNodeData(&graph, node_b) == 25;
result = result && GraphNodeGetId(node_b) == b;- In
Access.c:308:
// return without aborting.
static bool test_node_at_stale_id_deadend(void) {
WriteFmt("Testing GraphNodeAt rejects a stale node id (should abort)\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Access.c:322:
(void)GraphAddNodeR(&graph, 99);
(void)GraphNodeAt(&graph, a);
GraphDeinit(&graph);
Last updated on