Skip to content

Consider views for graphs (migrated from Trac #338) #335

Closed

Description

@networkx-trac

Original ticket https://networkx.lanl.gov/trac/ticket/338
Reported 2010-04-14 by @dschult, assigned to @dschult.

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.

Activity

  1. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    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.

  2. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    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

  3. ghost assigned on Dec 29, 2012
  4. dschult commented on Sep 4, 2017

    @dschult
    Member

    This is implemented in #2523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions