You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider views for graphs (migrated from Trac #338) #335
It would be nice to have a fast way to process parts of a graph.
A view could be faster than creating the induced subgraph
because it might not have to create the whole graph structure.
Let's see if that is really true.
In [https://networkx.lanl.gov/trac/changeset/1735/networkx/branches r1735] I committed a version of Views for subgraphs that is much faster to create
and just about as fast to use (especially for subgraphs with few nodes). This is a
lighter-weight implementation of views than creating a subclass of Graph.
Creation speed is orders of magnitude faster. I haven't seen much difference in
speed of shortest_path algorithms for a subgraph versus this view... but I've only
fed it pretty simple subgraphs so far.
(In [1744]) Latest attempt at a subgraphview class:
Creation of a view is much faster than subgraph, but using it is slower.
Essentialy if you lookup neighbors more than once it is better to store
the neighbors as a subgraph rather than use a view.
Test speed of creating Subgraph
0 0.00339698791504
1 0.00263094902039
2 0.00253200531006
Test speed of creating Subgraphview
0 2.21729278564e-05
1 1.59740447998e-05
2 1.4066696167e-05
Creating the subgraph(view) is also included here.
Time for shortest_path with subgraph
0 0.159543991089
1 0.159290790558
2 0.171217918396
Time for shortest_path with view
0 0.661740064621
1 0.648225784302
2 0.665271043777
Activity
networkx-trac commentedon Jul 20, 2012
Comment in Trac by @dschult, 2010-04-27
In [https://networkx.lanl.gov/trac/changeset/1735/networkx/branches r1735] I committed a version of Views for subgraphs that is much faster to create
and just about as fast to use (especially for subgraphs with few nodes). This is a
lighter-weight implementation of views than creating a subclass of Graph.
Creation speed is orders of magnitude faster. I haven't seen much difference in
speed of shortest_path algorithms for a subgraph versus this view... but I've only
fed it pretty simple subgraphs so far.
networkx-trac commentedon Jul 20, 2012
Comment in Trac by @dschult, 2010-05-06
(In [1744]) Latest attempt at a subgraphview class:
Creation of a view is much faster than subgraph, but using it is slower.
Essentialy if you lookup neighbors more than once it is better to store
the neighbors as a subgraph rather than use a view.
Addresses #338
Test speed of creating Subgraph
0 0.00339698791504
1 0.00263094902039
2 0.00253200531006
Test speed of creating Subgraphview
0 2.21729278564e-05
1 1.59740447998e-05
2 1.4066696167e-05
Creating the subgraph(view) is also included here.
Time for shortest_path with subgraph
0 0.159543991089
1 0.159290790558
2 0.171217918396
Time for shortest_path with view
0 0.661740064621
1 0.648225784302
2 0.665271043777
dschult commentedon Sep 4, 2017
This is implemented in #2523