Package networkx :: Module distance
[hide private]
[frames] | no frames]

Module distance

source code

Shortest paths, diameter, radius, eccentricity, and related methods.


Author: Aric Hagberg (hagberg@lanl.gov) Dan Schult(dschult@colgate.edu)

Functions [hide private]
 
eccentricity(G, v=None, sp=None, with_labels=False)
Return the eccentricity of node v in G (or all nodes if v is None).
source code
 
diameter(G, e=None)
Return the diameter of the graph G.
source code
 
periphery(G, e=None)
Return the periphery of the graph G.
source code
 
radius(G, e=None)
Return the radius of the graph G.
source code
 
center(G, e=None)
Return the center of graph G.
source code
 
_test_suite() source code
Function Details [hide private]

eccentricity(G, v=None, sp=None, with_labels=False)

source code 

Return the eccentricity of node v in G (or all nodes if v is None).

The eccentricity is the maximum of shortest paths to all other nodes.

The optional keyword sp must be a dict of dicts of shortest_path_length keyed by source and target. That is, sp[v][t] is the length from v to t.

If with_labels=True return dict of eccentricities keyed by vertex.

diameter(G, e=None)

source code 

Return the diameter of the graph G.

The diameter is the maximum of all pairs shortest path.

periphery(G, e=None)

source code 

Return the periphery of the graph G.

The periphery is the set of nodes with eccentricity equal to the diameter.

radius(G, e=None)

source code 

Return the radius of the graph G.

The radius is the minimum of all pairs shortest path.

center(G, e=None)

source code 

Return the center of graph G.

The center is the set of nodes with eccentricity equal to radius.