GraphNeighborAt
Description
Access outgoing neighbor id at given offset.
Parameters
| Name | Direction | Description |
|---|---|---|
g |
in | Graph to query. |
node_id |
in | Source node id. |
neighbor_idx |
in | Index in outgoing neighbor list, [0, out_degree). |
Success
Returns the GraphNodeId at the requested position in the outgoing adjacency list. The graph is not modified.
Failure
Does not return - aborts via LOG_FATAL for an invalid or stale node_id or out-of-bounds neighbor_idx.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Ops.c:148:
result = result && (GraphInDegree(&graph, b) == 0);
result = result && (GraphInDegree(&graph, c) == 1);
result = result && (GraphNeighborAt(&graph, a, 0) == c);
result = result && (GraphPredecessorAt(&graph, c, 0) == a);- In
Ops.c:232:
result = result && (GraphOutDegree(&graph, a) == 1);
result = result && (GraphInDegree(&graph, a) == 1);
result = result && (GraphNeighborAt(&graph, a, 0) == a);
result = result && (GraphPredecessorAt(&graph, a, 0) == a);
result = result && GraphMarkEdgeForRemoval(&graph, a, a);- In
Ops.c:373:
result = result && (GraphOutDegree(&graph, a) == 1);
result = result && (GraphEdgeCount(&graph) == 1);
result = result && (GraphNeighborAt(&graph, a, 0) == c);
result = result && (GraphNodeCount(&graph) == 2);- In
Insert.c:74:
result = result && GraphInDegree(&graph, b) == 1;
result = result && GraphInDegree(&graph, c) == 1;
result = result && GraphNeighborAt(&graph, a, 0) == b;
result = result && GraphNeighborAt(&graph, a, 1) == c;
result = result && GraphPredecessorAt(&graph, b, 0) == a;- In
Insert.c:75:
result = result && GraphInDegree(&graph, c) == 1;
result = result && GraphNeighborAt(&graph, a, 0) == b;
result = result && GraphNeighborAt(&graph, a, 1) == c;
result = result && GraphPredecessorAt(&graph, b, 0) == a;
result = result && GraphPredecessorAt(&graph, c, 0) == a;- In
Insert.c:103:
result = result && (GraphOutDegree(&graph, a) == 1);
result = result && (GraphInDegree(&graph, a) == 3);
result = result && (GraphNeighborAt(&graph, a, 0) == a);
result = result && (GraphPredecessorAt(&graph, a, 0) == a);
result = result && (GraphPredecessorAt(&graph, a, 1) == b);- In
Access.c:47:
result = result && GraphInDegree(&graph, b) == 1;
result = result && GraphInDegree(&graph, c) == 1;
result = result && GraphNeighborAt(&graph, a, 0) == b && GraphNeighborAt(&graph, a, 1) == c;
result = result && GraphNeighborAt(&graph, c, 0) == a;
result = result && GraphPredecessorAt(&graph, a, 0) == c;- In
Access.c:48:
result = result && GraphInDegree(&graph, c) == 1;
result = result && GraphNeighborAt(&graph, a, 0) == b && GraphNeighborAt(&graph, a, 1) == c;
result = result && GraphNeighborAt(&graph, c, 0) == a;
result = result && GraphPredecessorAt(&graph, a, 0) == c;
result = result && GraphPredecessorAt(&graph, b, 0) == a;- In
Access.c:122:
static bool test_graph_neighbor_access_oob_deadend(void) {
WriteFmt("Testing GraphNeighborAt out-of-bounds access (should abort)\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Access.c:133:
GraphAddEdge(&graph, a, b);
(void)GraphNeighborAt(&graph, b, 0);
GraphDeinit(&graph);
Last updated on