GraphMarkNodeForDeletion
Description
Mark a node for deletion on the next GraphCommitChanges.
Marked nodes remain visible until commit. This operation is safe during graph traversal and is intended for destructive passes that need stable iteration.
Parameters
| Name | Direction | Description |
|---|---|---|
node |
in | GraphNode handle to mark. |
Success
Returns true. The slot referenced by node is now flagged as marked; the graph’s pending-delete count grows by one. live_count is unchanged - the node is still observable through traversal and lookup until GraphCommitChanges runs.
Failure
Returns false when the node was already marked. The graph is not modified.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Graph.c:805:
}
bool GraphMarkNodeForDeletion(GraphNode node) {
GenericGraph *graph;
GenericGraphSlot *slot;- In
Graph.Ops.c:34:
static bool test_graph_mark_delete_commit_and_reuse(void) {
WriteFmt("Testing GraphMarkNodeForDeletion and GraphCommitChanges\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Graph.Ops.c:51:
GraphForeachNode(&graph, node) {
if (GraphNodeData(&graph, node) == 20) {
GraphMarkNodeForDeletion(node);
}
}- In
Graph.Ops.c:92:
bool result = !GraphNodeMarkedForDeletion(node);
result = result && GraphMarkNodeForDeletion(node);
result = result && GraphNodeMarkedForDeletion(node);
result = result && !GraphMarkNodeForDeletion(node);- In
Graph.Ops.c:94:
result = result && GraphMarkNodeForDeletion(node);
result = result && GraphNodeMarkedForDeletion(node);
result = result && !GraphMarkNodeForDeletion(node);
result = result && GraphUnmarkNodeForDeletion(node);
result = result && !GraphNodeMarkedForDeletion(node);- In
Graph.Ops.c:263:
bool result = GraphMarkEdgeForRemoval(&graph, a, b);
result = result && GraphMarkNodeForDeletion(GraphGetNode(&graph, b));
result = result && GraphEdgeMarkedForRemoval(&graph, a, b);
result = result && GraphNodeMarkedForDeletion(GraphGetNode(&graph, b));- In
Graph.Ops.c:296:
counts[GraphNodeIdIndex(b)] = 29;
bool result = GraphMarkNodeForDeletion(GraphGetNode(&graph, b));
result = result && (GraphCommitChanges(&graph) == 1);
result = result && !GraphContainsNode(&graph, b);- In
Graph.Ops.c:327:
GraphNode node = GraphGetNode(&graph, a);
(void)GraphMarkNodeForDeletion(node);
(void)GraphCommitChanges(&graph);
(void)GraphNodeVisit(node);- In
Graph.Init.c:37:
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);
Last updated on