Closed anfoss closed 1 year ago
Hi, thanks for raising the issue.
netgraph.__version__
), as well as the version of matplotlib (matplotlib.__version__
) that you are using. Hi,
Mmmh tried but hard to do without reproducing the network topology 1:1. I can provide the corresponding graphml object.
The error trace is
in <module> Graph(baseG, File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_main.py", line 1382, in __init__ super().__init__(edges, *args, **kwargs) File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_main.py", line 304, in __init__ self.node_positions = self._initialize_node_layout( File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_main.py", line 444, in _initialize_node_layout return self._get_node_positions(node_layout, node_layout_kwargs, origin, scale) File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_main.py", line 465, in _get_node_positions return get_circular_layout( File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_node_layout.py", line 52, in wrapped_layout_function components = _get_connected_components(adjacency_list) File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_utils.py", line 590, in _get_connected_components component = _dfs(adjacency_list, start) File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_utils.py", line 636, in _dfs _dfs(adjacency_list, node, visited) File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_utils.py", line 636, in _dfs _dfs(adjacency_list, node, visited) File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_utils.py", line 636, in _dfs _dfs(adjacency_list, node, visited) [Previous line repeated 988 more times] File "/opt/anaconda3/lib/python3.8/site-packages/netgraph/_utils.py", line 633, in _dfs visited.add(start) RecursionError: maximum recursion depth exceeded while calling a Python object
I am using netgraph v4.9.3 and matplotlib 3.4.1
I have a large network which for which I would like to visualize communities and multiple components.
How big are we talking here? From the error trace it seems that you are running into the recursion limit when computing the components.
Is there a way to override this?
Since there doesn't seem anything obviously wrong, increasing the recursion limit might actually allow you to pass through that computation. The recursion limit is a python setting (and independent of netgraph). You can change it with:
import resource, sys
resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
sys.setrecursionlimit(10**6)
However, keep two things in mind:
Personally, for large networks, I would try to compute and plot the properties of the network (component size, for example?) more directly. Alternatively, you can think about coarse-graining your network. Depending on what properties of the network you are interested in, there are different methods.
Final note: since you appear to use a circular layout, you probably will want to set reduce_edge_crossings
to False
in the node_layout_kwargs
. If your largest component exceeds a couple hundred nodes, attempting to reduce edge crossings will add significantly to your computation time.
Since I haven't heard from you, I will close the issue for now but feel free to re-open it if you run into further problems (or raise a new issue -- as appropriate).
I have a large network which for which I would like to visualize communities and multiple components.
I can load it in Cytoscape and do it there but I was looking for pythonic solution as it is much easier to export publication quality plot from matplotlib than Cytoscape.
However, it fails with RecursionError: maximum recursion depth exceeded while calling a Python object.
Is there a way to override this? I am working on a computer cluster and have enough RAM and memory for handling this