GraphMarkEdgeForRemoval
Description
Mark a directed edge for removal on the next GraphCommitChanges.
This operation is safe during traversal and does not structurally mutate the graph until 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 edge entry in the outgoing-neighbour list of from (and matching predecessor entry on to) is flagged as marked. edge_count is unchanged - the edge is still observable through traversal until GraphCommitChanges runs.
Failure
Returns false when the edge is absent or was already marked. The graph is not modified.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Graph.Ops.c:108:
static bool test_graph_mark_edge_for_removal(void) {
WriteFmt("Testing GraphMarkEdgeForRemoval and deferred edge commit\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Graph.Ops.c:127:
GraphNodeForeachNeighbor(node, neighbor) {
if (GraphNodeGetId(neighbor) == b) {
(void)GraphMarkEdgeForRemoval(&graph, GraphNodeGetId(node), GraphNodeGetId(neighbor));
}
}- In
Graph.Ops.c:134:
bool result = GraphHasEdge(&graph, a, b);
result = result && GraphMarkEdgeForRemoval(&graph, b, c);
result = result && !GraphMarkEdgeForRemoval(&graph, b, c);
result = result && !GraphMarkEdgeForRemoval(&graph, c, b);- In
Graph.Ops.c:135:
bool result = GraphHasEdge(&graph, a, b);
result = result && GraphMarkEdgeForRemoval(&graph, b, c);
result = result && !GraphMarkEdgeForRemoval(&graph, b, c);
result = result && !GraphMarkEdgeForRemoval(&graph, c, b);- In
Graph.Ops.c:136:
result = result && GraphMarkEdgeForRemoval(&graph, b, c);
result = result && !GraphMarkEdgeForRemoval(&graph, b, c);
result = result && !GraphMarkEdgeForRemoval(&graph, c, b);
u64 committed = GraphCommitChanges(&graph);- In
Graph.Ops.c:170:
bool result = !GraphEdgeMarkedForRemoval(&graph, a, b);
result = result && GraphMarkEdgeForRemoval(&graph, a, b);
result = result && GraphEdgeMarkedForRemoval(&graph, a, b);
result = result && !GraphMarkEdgeForRemoval(&graph, a, b);- In
Graph.Ops.c:172:
result = result && GraphMarkEdgeForRemoval(&graph, a, b);
result = result && GraphEdgeMarkedForRemoval(&graph, a, b);
result = result && !GraphMarkEdgeForRemoval(&graph, a, b);
result = result && GraphUnmarkEdgeForRemoval(&graph, a, b);
result = result && !GraphEdgeMarkedForRemoval(&graph, a, b);- In
Graph.Ops.c:200:
GraphAddEdge(&graph, a, c);
bool result = GraphMarkEdgeForRemoval(&graph, a, b);
result = result && GraphMarkEdgeForRemoval(&graph, a, c);
result = result && GraphEdgeMarkedForRemoval(&graph, a, b);- In
Graph.Ops.c:201:
bool result = GraphMarkEdgeForRemoval(&graph, a, b);
result = result && GraphMarkEdgeForRemoval(&graph, a, c);
result = result && GraphEdgeMarkedForRemoval(&graph, a, b);
result = result && GraphEdgeMarkedForRemoval(&graph, a, c);- In
Graph.Ops.c:234:
result = result && (GraphNeighborAt(&graph, a, 0) == a);
result = result && (GraphPredecessorAt(&graph, a, 0) == a);
result = result && GraphMarkEdgeForRemoval(&graph, a, a);
result = result && (GraphCommitChanges(&graph) == 1);
result = result && (GraphEdgeCount(&graph) == 0);- In
Graph.Ops.c:262:
GraphAddEdge(&graph, d, b);
bool result = GraphMarkEdgeForRemoval(&graph, a, b);
result = result && GraphMarkNodeForDeletion(GraphGetNode(&graph, b));
result = result && GraphEdgeMarkedForRemoval(&graph, a, b);- In
Graph.Init.c:38:
result = result && (GraphNodeVisit(GraphGetNode(&graph, first_id)) == 1);
result = result && GraphMarkNodeForDeletion(GraphGetNode(&graph, second_id));
result = result && GraphMarkEdgeForRemoval(&graph, third_id, third_id);
GraphClear(&graph);
Last updated on