Skip to content

More Network Flow Algorithms (migrated from Trac #558) #550

Closed

Activity

  1. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Comment in Trac by @hagberg, 2011-05-25

  2. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Comment in Trac by @hagberg, 2011-05-25

  3. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Comment in Trac by @hagberg, 2011-06-24

  4. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Comment in Trac by @loicseguin, 2012-03-04

    To follow up on this project, I made a quick speed test on the push-relabel algorithms that have been developed last summer. Since there are three of them, it would be better to only include the fastest one. The results of the test show that all push-relabel algorithms are slower than the current implementation of Ford-Fulkerson.

    A typical run looks like

    '''
    $ python compare_relabel.py
    nx.vanilla_push_relabel_maxflow 2.246 s
    nx.relabel_to_front_maxflow 16.466 s
    nx.highest_label_maxflow 69.296 s
    nx.ford_fulkerson 0.384 s
    '''

    Without the random graph test, then the difference is smaller

    '''
    $ python compare_relabel.py
    nx.vanilla_push_relabel_maxflow 0.888 s
    nx.relabel_to_front_maxflow 6.250 s
    nx.highest_label_maxflow 0.763 s
    nx.ford_fulkerson 0.317 s

    $ python3 compare_relabel.py
    nx.vanilla_push_relabel_maxflow 1.178 s
    nx.relabel_to_front_maxflow 5.895 s
    nx.highest_label_maxflow 0.909 s
    nx.ford_fulkerson 0.420 s
    '''

    Making the instance of the pyramid graph bigger eventually shows the power of the push-relabel method (with a pyramid graph of 25 layers):

    '''
    $python compare_relabel.py
    nx.vanilla_push_relabel_maxflow 2.713 s
    nx.relabel_to_front_maxflow 29.800 s
    nx.highest_label_maxflow 1.542 s
    nx.ford_fulkerson 1.826 s
    '''

    It seems the so called ''vanilla'' version has the best performance overall. I'll try and see if there are any speed improvements that can make it faster and then I'll push it to the main repository. The "highest label" has inconsistent performance and the "relabel to front" is clearly too slow.

    Angga's code merged with the most recent NetworkX repository can be found at https://github.com/loicseguin/networkx.

  5. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Attachment in Trac by @loicseguin, 2012-03-04: compare_relabel.py

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