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

Function QueryGraph_Print

src/graph/query_graph.c:772–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770}
771
772void QueryGraph_Print
773(
774 const QueryGraph *qg
775) {
776 char *buff = calloc(1024, sizeof(char));
777
778 uint node_count = QueryGraph_NodeCount(qg);
779 uint edge_count = QueryGraph_EdgeCount(qg);
780
781 for(int i = 0; i < node_count; i++) {
782 QGNode *n = qg->nodes[i];
783 if(QGNode_IncomeDegree(n) + QGNode_OutgoingDegree(n) == 0) {
784 // floating node
785 int rc __attribute__((unused));
786 rc = asprintf(&buff, "%s%s;\n", buff, n->alias);
787 }
788 }
789
790 for(int i = 0; i < edge_count; i++) {
791 QGEdge *e = qg->edges[i];
792 int rc __attribute__((unused));
793 rc = asprintf(&buff, "%s%s -> %s;\n", buff, e->src->alias, e->dest->alias);
794 }
795
796 printf("%s\n", buff);
797 free(buff);
798}
799
800// frees entire graph
801void QueryGraph_Free

Callers

nothing calls this directly

Calls 4

QueryGraph_NodeCountFunction · 0.85
QueryGraph_EdgeCountFunction · 0.85
QGNode_IncomeDegreeFunction · 0.85
QGNode_OutgoingDegreeFunction · 0.85

Tested by

no test coverage detected