]> granicus.if.org Git - graphviz/commitdiff
0002434: neatogen: fix spline not being created
authorJohannes Dewender <github@JonnyJD.net>
Tue, 18 Mar 2014 21:26:04 +0000 (22:26 +0100)
committerJohannes Dewender <github@JonnyJD.net>
Tue, 18 Mar 2014 21:26:04 +0000 (22:26 +0100)
We try to make a multi spline when there are multiple edges between two
nodes. We only make create this multi spline for the leader of these
edges.
If the leader already has a spline set and we are supposed to use given
splines (Nop > 1), then no multi spline will be created at all,
also not for other splines.

So we don't include these splines in the search for equivalent edges.

lib/neatogen/neatosplines.c

index 80d4198e7c8894c234a2932dec7f0f6d651686de..cbf2d3aff0635891cf2c4dd601ac9edd42cf084c 100644 (file)
@@ -714,11 +714,21 @@ splineEdges(graph_t * g, int (*edgefn) (graph_t *, expand_t*, int),
     map = dtopen(&edgeItemDisc, Dtoset);
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
        for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-           edge_t *leader = equivEdge(map, e);
-           if (leader != e) {
-               ED_count(leader)++;
-               ED_to_virt(e) = ED_to_virt(leader);
-               ED_to_virt(leader) = e;
+           if (!(Nop > 1 && ED_spl(e))) {
+               /* with nop > 1 (use given edges)
+                * and a given edge, no edges are created
+                * so other edges being equivalent to this
+                * also wouldn't be created
+                */
+               edge_t *leader = equivEdge(map, e);
+               if (leader != e) {
+                   fprintf(stderr, "leader != e\n");
+                   ED_count(leader)++;
+                   ED_to_virt(e) = ED_to_virt(leader);
+                   ED_to_virt(leader) = e;
+               }
+           } else {
+                   ED_count(e)++;
            }
        }
     }