Dear Lorenzo,
On Mon, Dec 14, 2009 at 7:37 PM, Lorenzo Isella
<address@hidden> wrote:
> Dear All,
> I am running igraph (R bindings) on two different 64-bit machines (one
> running Ubuntu 9.10 and igraph for R compiled from source and the
> other one Debian testing and igraph installed as a binary from
> deb http://debian.cran.r-project.org/cran2deb/debian-amd64/ testing/ ).
>
> I realized that I was getting very different results in the
> calculation of the graph diameter for the same (weighted) graph on my
> machines and I had a look at the help.
> The package installed as a binary has the following usage of get.diameter:
>
> Diameter of a graph
>
> Description:
>
> The diameter of a graph is the length of the longest geodesic.
>
> Usage:
>
> diameter(graph, directed = TRUE, unconnected = TRUE, weights = NULL)
> get.diameter (graph, directed = TRUE, unconnected = TRUE, weights = NULL)
> farthest.nodes (graph, directed = TRUE, unconnected = TRUE,
> weights = NULL)
>
> Arguments:
>
> graph: The graph to analyze.
>
> directed: Logical, whether directed or undirected paths are to be
> considered. This is ignored for undirected graphs.
>
> unconnected: Logical, what to do if the graph is unconnected. If FALSE,
> the function will return the largest possible diameter which
> is the number of vertices. If TRUE, the diameters of the
> connected components will be calculated and the largest one
> will be returned.
>
> weights: Optional positive weight vector for calculating weighted
> distances. If the graph has a ‘weight’ edge attribute, then
> this is used by default
>
> so, it calculates the diameter for a weighted graph, whereas the
> package installed from source has the same documentation as what I
> find online
>
> http://igraph.sourceforge.net/doc/R/diameter.html
>
> which does not mention the weight at all.
because you have two different igraph versions on the two machines,
the newer supports weighted diameter calculation, the older does not.
> Which one is the 'correct' get.diameter?
Both, but one of them is unweighted.
> And also, given a weighted
> graph and an R library which uses the weight when calculating the
> diameter, how do I tell it to calculate the topological, unweighted
> diameter?
Supply weights=NA to diameter().
Best,
Gabor
> Kind Regards
>
> Lorenzo
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
-- Gabor Csardi <address@hidden> UNIL DGM