[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Re: Differences in Usage of get.diameter for R Package

From: Lorenzo Isella
Subject: [igraph] Re: Differences in Usage of get.diameter for R Package
Date: Mon, 21 Dec 2009 18:16:02 +0100
User-agent: Thunderbird (X11/20090817)

Hello Gabor,
And thanks for your clear answer.
If I understand correctly, my Debian testing system is running a slightly more up-to-date version of the igraph library (R bindings) than my Ubuntu box. I see that the version I am running under Ubuntu is the R package I download from CRAN, but it is not the same library as the one I downloaded from

deb http://debian.cran.r-project.org/cran2deb/debian-amd64/ testing/

Hence my only question: where do I fetch the corresponding version of the igraph for Ubuntu 9.10 (binary package or source does not really matter)?

Many thanks

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().


> Kind Regards
> Lorenzo
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

-- Gabor Csardi <address@hidden> UNIL DGM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]