Skip to content

Commit 04831ed

Browse files
committed
figures for doc:build structure
1 parent 9b6dd3e commit 04831ed

20 files changed

+123
-8
lines changed

dhg/visualization/structure/draw.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def draw_digraph(
105105
pull_e_strength: float = 1.0,
106106
pull_center_strength: float = 1.0,
107107
):
108-
r"""Draw the directed graph structure.
108+
r"""Draw the directed graph structure.
109109
110110
Args:
111111
``g`` (``dhg.DiGraph``): The DHG's directed graph object.
@@ -178,7 +178,7 @@ def draw_bigraph(
178178
pull_v_center_strength: float = 1.0,
179179
):
180180
r"""Draw the bipartite graph structure.
181-
181+
182182
Args:
183183
``g`` (``dhg.BiGraph``): The DHG's bipartite graph object.
184184
``e_style`` (``str``): The edge style. The supported edge styles are only ``'line'``. Defaults to ``'line'``.
@@ -255,7 +255,7 @@ def draw_bigraph(
255255
draw_vertex(
256256
ax,
257257
np.vstack([u_coor, v_coor]),
258-
u_label + v_label if u_label is not None and v_label is not None else None,
258+
list(u_label) + list(v_label) if u_label is not None and v_label is not None else None,
259259
u_font_size + v_font_size,
260260
font_family,
261261
u_size + v_size,
@@ -287,7 +287,7 @@ def draw_hypergraph(
287287
pull_center_strength: float = 1.0,
288288
):
289289
r"""Draw the hypergraph structure.
290-
290+
291291
Args:
292292
``hg`` (``dhg.Hypergraph``): The DHG's hypergraph object.
293293
``e_style`` (``str``): The style of hyperedges. The available styles are only ``'circle'``. Defaults to ``'circle'``.

dhg/visualization/structure/utils.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,14 @@ def draw_circle_edge(
7676
for eidx, lines in enumerate(line_paths):
7777
pathdata = []
7878
for line in lines:
79+
if len(line) == 0:
80+
continue
7981
start_pos, end_pos = line
8082
pathdata.append((Path.MOVETO, start_pos.tolist()))
8183
pathdata.append((Path.LINETO, end_pos.tolist()))
8284

85+
if len(list(zip(*pathdata))) == 0:
86+
continue
8387
codes, verts = zip(*pathdata)
8488
path = Path(verts, codes)
8589
ax.add_patch(
@@ -165,6 +169,15 @@ def hull_layout(n_v, e_list, pos, v_size, radius_increment=0.3):
165169
line_path_for_e = []
166170
arc_path_for_e = []
167171

172+
if len(edge) == 1:
173+
arc_path_for_e.append([pos[edge[0]], 0, 360, vertices_radius[edge[0]]])
174+
175+
vertices_radius[edge] += vertices_increased_radius[edge]
176+
177+
line_paths[e_idx] = line_path_for_e
178+
arc_paths[e_idx] = arc_path_for_e
179+
continue
180+
168181
pos_in_edge = pos[edge]
169182
if len(edge) == 2:
170183
vertices_index = np.array((0, 1), dtype=np.int64)
23.3 KB
Loading
16.7 KB
Loading
71.9 KB
Loading
10.8 KB
Loading
10.8 KB
Loading
16.8 KB
Loading
17.5 KB
Loading
52.8 KB
Loading

0 commit comments

Comments
 (0)