igraph-help
[Top][All Lists]

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

 From: Lorenzo Isella Subject: [igraph] Differences in Usage of get.diameter for R Package Date: Mon, 14 Dec 2009 19:37:34 +0100

```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.
Which one is the 'correct' get.diameter? 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?
Kind Regards

Lorenzo

```