| 770 | } |
| 771 | |
| 772 | void 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 |
| 801 | void QueryGraph_Free |
nothing calls this directly
no test coverage detected