MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / QueryGraph_RemoveNode

Function QueryGraph_RemoveNode

src/graph/query_graph.c:567–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567QGNode *QueryGraph_RemoveNode
568(
569 QueryGraph *qg,
570 QGNode *n
571) {
572 ASSERT(qg != NULL && n != NULL);
573
574 // remove node from query graph
575 // remove and free all edges associated with node
576 uint incoming_edge_count = array_len(n->incoming_edges);
577 for(uint i = 0; i < incoming_edge_count; i++) {
578 QGEdge *e = n->incoming_edges[i];
579 QueryGraph_RemoveEdge(qg, e);
580 QGEdge_Free(e);
581 }
582
583 uint outgoing_edge_count = array_len(n->outgoing_edges);
584 for(uint i = 0; i < outgoing_edge_count; i++) {
585 QGEdge *e = n->outgoing_edges[i];
586 QueryGraph_RemoveEdge(qg, e);
587 QGEdge_Free(e);
588 }
589
590 // remove node from graph nodes
591 uint node_count = QueryGraph_NodeCount(qg);
592 uint i = 0;
593 for(; i < node_count; i++) {
594 if(n == qg->nodes[i]) {
595 array_del_fast(qg->nodes, i);
596 break;
597 }
598 }
599
600 return n;
601}
602
603QGEdge *QueryGraph_RemoveEdge
604(

Callers 3

_RemovePathFromGraphFunction · 0.85

Calls 4

array_lenFunction · 0.85
QueryGraph_RemoveEdgeFunction · 0.85
QGEdge_FreeFunction · 0.85
QueryGraph_NodeCountFunction · 0.85

Tested by 1