How to calcuate diameter in directed network

1,806 views
Skip to first unread message

wywin2000

unread,
Jun 24, 2009, 3:35:00 PM6/24/09
to networkx-discuss
Hi,

I try to use the function "nx.diameter(G)" to calcuate the
diameter of network G that is a directed network. However, the result
is “Graph not connected: infinite path length”. It seems to me that
this function does not deal with the directed network case.

I guess there must be a "indirect" way to deal with it, I am
looking for it in the documents, while waiting for your guys kind
responses.

Yong

wywin2000

unread,
Jun 24, 2009, 4:58:28 PM6/24/09
to networkx-discuss
I am doubting right now that : is there a corresponding concept of
diameter in directed network or not?

Dan Schult

unread,
Jun 24, 2009, 11:22:25 PM6/24/09
to networkx...@googlegroups.com
It seems that there is a definition of diameter for strongly connected
directed graphs. google pulls up a number of articles for the search
diameter directed graph

My understanding is that the NetworkX function diameter works in
the cases where it is defined. Note that the diameter is not defined
for many undirected graphs (those that are not connected).

Dan

wywin2000

unread,
Jun 25, 2009, 9:27:55 PM6/25/09
to networkx-discuss
Thanks Dan!

From the paper "Graph structure in the web" in WWW conference by
Broder et al, the definition of diameter is that:

The diameter of a graph, directed or undirected, is the maximum over
**all ordered paris**(u,v) of the shortest path from u to v.

So I think, I can first get all ordered pairs whose shoest path is not
infinity, and then find the maximum one.

Thanks again for your explanations.
> >> Yong- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages