Skip to content

How to calculate single source shortest paths #8

@Bonsanto

Description

@Bonsanto

Hello, there is a library for Python called networkx, and it has an interesting functionality I couldn't find in jgrapht, which is the possibility of calculating all reachable vertexes from given vertex and with a distance smaller than a threshold (see example here).

e.g.

>>> G=nx.path_graph(5)
>>> length=nx.single_source_shortest_path_length(G,0)
>>> length[4]
4
>>> print(length)
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions