xgi-org / xgi

CompleX Group Interactions (XGI) is a Python package for higher-order networks.
https://xgi.readthedocs.io
Other
180 stars 28 forks source link

`draw_dihypergraph` raises an error #469

Closed maximelucas closed 11 months ago

maximelucas commented 1 year ago

Running this

import xgi

edges = [
    [[8, 9], [0]],
    [[1, 2], [0]],
    [[0, 3], [1]],
    [[1, 3], [2]],
    [[1, 5], [3]],
    [[2, 5], [4]],
    [[3, 4], [5]],
    [[6, 7], [5]],
    [[5, 8], [6]],
    [[6, 8], [7]],
    [[6, 0], [8]],
    [[7, 0], [9]],
]

H = xgi.DiHypergraph(edges)
xgi.draw_dihypergraph(HH)

Yields:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In [269], line 1
----> 1 xgi.draw_dihypergraph(HH)

File ~/Dropbox (ISI Foundation)/WORK/SCIENCE/xgi/xgi/drawing/draw.py:1692, in draw_dihypergraph(DH, ax, lines_fc, lines_lw, line_head_width, node_fc, node_ec, node_lw, node_size, edge_marker_toggle, edge_marker_fc, edge_marker_ec, edge_marker, edge_marker_lw, edge_marker_size, max_order, node_labels, hyperedge_labels, settings, **kwargs)
   1689 d = len(he) - 1
   1690 if d > 0:
   1691     # identify the center of the edge in the augemented projection
-> 1692     center = [n for n in phantom_nodes if set(G_aug.neighbors(n)) == he][0]
   1693     x_center, y_center = pos[center]
   1694     for node in DH.edges.dimembers(id)[0]:

IndexError: list index out of range
thomasrobiglio commented 1 year ago

Hi @maximelucas, I am not able to reproduce your error:

Screenshot 2023-09-03 alle 16 05 15

I noticed that in the last line you have xgi.draw_dihypergraph(HH) while the name of the DiHypergraph you created is H... might that be the issue?

maximelucas commented 1 year ago

Hmm might be that I'm using a local version where I changed some drawing functions then, I'll check later.

maximelucas commented 11 months ago

Cannot reproduce, closing.