GraphHasEdge
Description
Check whether graph contains directed edge from -> to.
from and to must both be live node ids. This query treats stale ids as programmer error and aborts instead of quietly collapsing them to “not found”.
Parameters
| Name | Direction | Description |
|---|---|---|
g |
in | Graph to query. |
from |
in | Source node id. |
to |
in | Destination node id. |
Success
true when the directed edge exists.
Failure
false
Usage example (Cross-references)
Usage examples (Cross-references)
static bool test_graph_has_edge_query(void) {
WriteFmt("Testing GraphHasEdge\n");
DefaultAllocator alloc = DefaultAllocatorInit(); GraphAddEdge(&graph, green, blue);
bool result = GraphHasEdge(&graph, red, green);
result = result && GraphHasEdge(&graph, green, blue);
result = result && !GraphHasEdge(&graph, blue, green);
bool result = GraphHasEdge(&graph, red, green);
result = result && GraphHasEdge(&graph, green, blue);
result = result && !GraphHasEdge(&graph, blue, green);
result = result && !GraphHasEdge(&graph, red, blue); bool result = GraphHasEdge(&graph, red, green);
result = result && GraphHasEdge(&graph, green, blue);
result = result && !GraphHasEdge(&graph, blue, green);
result = result && !GraphHasEdge(&graph, red, blue);
result = result && (ZstrCompare(*GraphNodePtrAt(&graph, red), "red") == 0); result = result && GraphHasEdge(&graph, green, blue);
result = result && !GraphHasEdge(&graph, blue, green);
result = result && !GraphHasEdge(&graph, red, blue);
result = result && (ZstrCompare(*GraphNodePtrAt(&graph, red), "red") == 0);- In
Graph.Ops.c:65:
result = result && (GraphInDegree(&graph, a) == 1);
result = result && (GraphInDegree(&graph, c) == 0);
result = result && GraphHasEdge(&graph, c, a);
result = result && (GraphPredecessorAt(&graph, a, 0) == c);- In
Graph.Ops.c:133:
}
bool result = GraphHasEdge(&graph, a, b);
result = result && GraphMarkEdgeForRemoval(&graph, b, c);
result = result && !GraphMarkEdgeForRemoval(&graph, b, c);- In
Graph.Ops.c:141:
result = result && (committed == 2);
result = result && !GraphHasEdge(&graph, a, b);
result = result && GraphHasEdge(&graph, a, c);
result = result && !GraphHasEdge(&graph, b, c);- In
Graph.Ops.c:142:
result = result && (committed == 2);
result = result && !GraphHasEdge(&graph, a, b);
result = result && GraphHasEdge(&graph, a, c);
result = result && !GraphHasEdge(&graph, b, c);
result = result && (GraphEdgeCount(&graph) == 1);- In
Graph.Ops.c:143:
result = result && !GraphHasEdge(&graph, a, b);
result = result && GraphHasEdge(&graph, a, c);
result = result && !GraphHasEdge(&graph, b, c);
result = result && (GraphEdgeCount(&graph) == 1);
result = result && (GraphOutDegree(&graph, a) == 1);- In
Graph.Ops.c:177:
result = result && !GraphUnmarkEdgeForRemoval(&graph, a, b);
result = result && (GraphCommitChanges(&graph) == 0);
result = result && GraphHasEdge(&graph, a, b);
result = result && (GraphEdgeCount(&graph) == 1);- In
Graph.Ops.c:208:
result = result && GraphEdgeMarkedForRemoval(&graph, a, c);
result = result && (GraphCommitChanges(&graph) == 1);
result = result && GraphHasEdge(&graph, a, b);
result = result && !GraphHasEdge(&graph, a, c);
result = result && (GraphOutDegree(&graph, a) == 1);- In
Graph.Ops.c:209:
result = result && (GraphCommitChanges(&graph) == 1);
result = result && GraphHasEdge(&graph, a, b);
result = result && !GraphHasEdge(&graph, a, c);
result = result && (GraphOutDegree(&graph, a) == 1);
result = result && (GraphInDegree(&graph, b) == 1);
Last updated on