igraph-help
[Top][All Lists]
Advanced

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

[igraph] Weighted graphs and the use of E(g)$weight as a distance measur


From: Harker Rhodes
Subject: [igraph] Weighted graphs and the use of E(g)$weight as a distance measure
Date: Sun, 12 Jul 2015 20:41:33 -0400

As I understand it, all of the igraph functions for measures of centrality and community detection treat the weights in a weighted graph as distance measures. In many contexts it is more natural to use an affinity measure as the weight scaled so that edges with a weight of close to 0 correspond to the absence of an edge in the corresponding unweighted graph, and those with a weight of close to 1 correspond to the presence of an edge in the corresponding unweighted graph. 

The obvious work-around is to remember that E(g)$weight is the distance measure used internally by igraph and define some other edge attribute, E(g)$WEIGHT as the affinity measure which is the more natural feature.  The problem is, of course, that one has to remember to recalculate E(g)$weight before every call to the existing igraph function.

It would be very convenient if for the graph functions for measures of centrality and community detection there were an argument "distance" for which a default value of distance=TRUE results in the function performing as it does now (for downward compatibility).  A value of distance=FALSE would result in the function using 1/E(g)$weight rather than E(g)$weight as the distance measure and a value of distance="vector" would result in a user-defined distance, "vector".

Along the same vein, much of the existing documentation for the igraph package pretty much ignores how the package handles weighted graphs. For example, the documentation for "diameter" says: 

weights     Optional positive weight vector for calculating weighted distances. If the graph has a weight edge attribute, then this is used by default.

It does not explicitly say that the weights are used as a distance measure. Presumably "everyone" already knows that, but I did not.  Since an edge weight of 0 corresponds to an absent edge I assumed that a weight of close to 0 to represents a very long distance (a very weak link or an edge that is "almost absent").

Harker

C. Harker Rhodes, MD, PhD
Professor of Pathology and Neurology (Retired)
Geisel School of Medicine at Dartmouth

Senior Scientist [C]; National Institute of Mental Health
Human Brain Collection Core
10 Center Drive, Rm. 4N306, Bethesda, MD
Phone: 603-443-3360
 


reply via email to

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