[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] Selecting vertices for centrality analysis in R
From: |
Jorge Gil |
Subject: |
[igraph] Selecting vertices for centrality analysis in R |
Date: |
Mon, 17 Dec 2012 15:22:35 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
Hi all,
I'm trying to run centrality analysis on a graph in R but only want to
get the results for a selection of vertices. The graph has edge weight
attributes and when I run the betweenness analysis for all vertices it
works, but for a selection of them it crashes. I attach a sample of this
data to this email.
It might be a problem with the way I'm selecting vertices for analysis.
The selection of vertices is dynamic and changes in a loop, and it is
stored in a vector (lo) containing the id name (character) of the vertices.
The code I'm running is:
bet<-betweenness(lg,v=V(lg)[name %in%
lo$road_id],directed=F,normalized=T,weights=E(lg)$metric)
If I run the above without weights it never crashes, nor does it crash
if I calculate closeness.
betN<-betweenness(lg,v=V(lg)[name %in%
lo$road_id],directed=F,normalized=T)
Of course it could also be a problem with the weights, but the values
are all positive >0, and if I run the analysis for all vertices it
doesn't crash either.
betN<-betweenness(lg,directed=F,normalized=T,weights=E(lg)$metric)
So I assume I'm doing something wrong with the vertex selection.
As a final point: I would like the weight to be selected dynamically so
that I can repeat the analysis in a loop for different weights. How can
I refer to the Edge attributes dynamically, using an index for example.
Thank you in advance,
Jorge
--
Jorge Gil
PhD Candidate
TU Delft / Faculty of Architecture
Department of Urbanism
Chair of Spatial Planning and Strategy
Julianalaan 134
2628 BL Delft
P.O. Box 5043
2600 GA Delft
The Netherlands
www.tudelft.nl
roadnet.RData
Description: Binary data
- [igraph] Selecting vertices for centrality analysis in R,
Jorge Gil <=