Giter Club home page Giter Club logo

Comments (4)

paulbrodersen avatar paulbrodersen commented on May 18, 2024

Hi, thanks for raising the issue.

  1. Could you create a minimal, reproducible example that results in the error?
  2. Could you post the full error trace, rather than just the last line?
  3. Please also note the netgraph version (netgraph.__version__), as well as the version of matplotlib (matplotlib.__version__) that you are using.

from netgraph.

anfoss avatar anfoss commented on May 18, 2024

Hi,

  1. Mmmh tried but hard to do without reproducing the network topology 1:1. I can provide the corresponding graphml object.

  2. 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

  3. I am using netgraph v4.9.3 and matplotlib 3.4.1

from netgraph.

paulbrodersen avatar paulbrodersen commented on May 18, 2024

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:

  1. In your dataset, each node is probably just an int or a short string, and each edge is probably some tuple of those. When plotting, each node and each edge will be represented by matplotlib artists with several 1000-fold higher memory requirement. HPC node or not, you may still run out RAM, and it will be worth working out on a smaller graph, what your memory requirements might be in the end.
  2. Each node and each edge will require several 100 pixels to be discernible in the final plot (the artists themselves plus some whitespace around them). A monitor has about 2 million pixels available. You may easily run out of pixels if you try to plot the whole network in one figure.

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.

from netgraph.

paulbrodersen avatar paulbrodersen commented on May 18, 2024

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).

from netgraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.