}
}
-static int write_subgs(Agraph_t *g, GVJ_t *job, bool top, state_t *sp) {
+/// write out subgraphs
+///
+/// \return True if the given graph has any subgraphs
+static bool write_subgs(Agraph_t *g, GVJ_t *job, bool top, state_t *sp) {
Agraph_t* sg;
sg = agfstsubg(g);
- if (!sg) return 0;
+ if (!sg) return false;
gvputs(job, ",\n");
indent(job, sp->Level++);
gvputs(job, "]");
}
- return 1;
+ return true;
}
static int agseqasc(Agedge_t **lhs, Agedge_t **rhs)
}
}
-static int write_nodes(Agraph_t *g, GVJ_t *job, bool top, int has_subgs, state_t *sp) {
+static int write_nodes(Agraph_t *g, GVJ_t *job, bool top, bool has_subgs, state_t *sp) {
Agnode_t* n;
n = agfstnode(g);
int ncnt = 0;
int ecnt = 0;
int sgcnt = 0;
- int has_subgs;
Dt_t* map;
if (top) {
indent(job, sp->Level);
gvprintf(job, "\"_gvid\": %d", GD_gid(g));
}
- has_subgs = write_subgs(g, job, top, sp);
+ bool has_subgs = write_subgs(g, job, top, sp);
write_nodes (g, job, top, has_subgs, sp);
write_edges (g, job, top, sp);
gvputs(job, "\n");