]> granicus.if.org Git - graphviz/commitdiff
dot.demo/neatopack.c: add missing initialization
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 4 Jul 2022 09:43:14 +0000 (11:43 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 25 Jul 2022 18:24:49 +0000 (20:24 +0200)
Normally gvLayoutJobs does this initialization, but since we call
ccomps before doing the layout and it expects graphs and nodes to have
'Agraphinfo_t' and 'Anodeinfo_t' records attached already, we must do
this initialization in the user program instead, see
https://graphviz.org/pdf/pack.3.pdf.

Fixes first part of
https://gitlab.com/graphviz/graphviz/-/issues/1800.

dot.demo/neatopack.c

index e86d7d1339201f0f43ce63fc12d3fd525b13c5ad..f7db2af115c47c9e959f5358d2e321af9a54a54c 100644 (file)
@@ -23,6 +23,9 @@ int main(int argc, char *argv[]) {
     fp = stdin;
   graph_t *g = agread(fp, NULL);
 
+  aginit(g, AGRAPH, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
+  aginit(g, AGNODE, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
+
   int ncc;
   graph_t **cc = ccomps(g, &ncc, NULL);