Skip to content

Commit d801058

Browse files
committed
fix: store edge routing information on the Layout object in a property
1 parent 902f4c4 commit d801058

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/igraph/layout.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ class Layout:
5656
>>> layout[1] = coords
5757
>>> print(layout[1])
5858
[0, 3]
59+
60+
Optionally, a layout may have I{edge routing} information attached to
61+
each edge in the layout in the L{edge_routing} property.
62+
63+
@ivar edge_routing: C{None} if no edge routing information is available,
64+
or a list of lists of control point coordinates, one for each edge. When
65+
an edge has control points, it should be drawn in a way that the edge
66+
passes through all the control points in the order they appear in the list.
5967
"""
6068

6169
def __init__(self, coords=None, dim=None):
@@ -69,6 +77,8 @@ def __init__(self, coords=None, dim=None):
6977
length of the coordinate list is zero, otherwise it should be left as
7078
is.
7179
"""
80+
self.edge_routing = None
81+
7282
if coords is not None:
7383
self._coords = [list(coord) for coord in coords]
7484
else:
@@ -675,10 +685,12 @@ def _layout_sugiyama(
675685
i-th matrix contains the control points of edge I{i} in the original graph
676686
(or an empty matrix if no control points are needed on the edge)
677687
"""
678-
layout, routing = GraphBase._layout_sugiyama(
688+
coords, routing = GraphBase._layout_sugiyama(
679689
graph, layers, weights, hgap, vgap, maxiter
680690
)
681-
return Layout(layout), routing
691+
layout = Layout(coords)
692+
layout.edge_routing = routing
693+
return layout
682694

683695

684696
def _layout_method_wrapper(func):

0 commit comments

Comments
 (0)