Currently, visualizing an empty graph (or an empty pattern) raises an exception.
>>> OpenGraph(nx.Graph(), (), (), {}).draw()
[...]
File "/home/tmartine/miniforge3/lib/python3.13/site-packages/graphix/visualization.py", line 710, in _
l_max = max(layers.values())
ValueError: max() iterable argument is empty
>>> Pattern().draw()
[...]
File "/home/tmartine/miniforge3/lib/python3.13/site-packages/numpy/linalg/_linalg.py", line 144, in _raise_linalgerror_singular
raise LinAlgError("Singular matrix")
numpy.linalg.LinAlgError: Singular matrix
In #549, the situation will be handled more gracefully by raising a ValueError with a dedicated message. However, it would be preferable to allow visualization of empty graphs without any failures.
Currently, visualizing an empty graph (or an empty pattern) raises an exception.
In #549, the situation will be handled more gracefully by raising a
ValueErrorwith a dedicated message. However, it would be preferable to allow visualization of empty graphs without any failures.