|
From: | J Biel |
Subject: | [igraph] problem using diameter and shortest.paths |
Date: | Wed, 24 Jun 2009 10:03:37 +0000 |
Hi folks, I'm trying to understand how the diameter of a network is computed. It seemed to me that applying shortest.paths to each vertex individually, and then computing the max, it would give me the same result max_short_path = function(node,g){ tmp=shortest.paths(g,node) val = max(tmp) return(val) } vec=seq(0,vcount(g)-1) val=max(apply(as.array(vec),1,indiam,g)) however, for my directed network of ~30,000 nodes and ~831727 edges I get val=7, whereas diam=diameter(g) gives me 16. Then, I realised I had to use the "mode" option in shortest.paths, to specify that the network is directed (directed is TRUE for my graph, but if you don't specify it to shortest.path, then it considers the graph to be undirected). So just randomly picking some nodes, I found out that some of the shortest.paths could be Inf. So now, the question is, if diameter is seeing my graph as directed, why I'm not obtaining diam=Inf? What is diameter doing? Anybody? Thanks, Joan Vertices: 38760 Edges: 831727 and I'm trying to understand how the diameter is computed Disfruta antes que nadie del nuevo Windows Live Messenger |
[Prev in Thread] | Current Thread | [Next in Thread] |