[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] Eigenvector centrality
From: |
Matthew Walker |
Subject: |
[igraph] Eigenvector centrality |
Date: |
Tue, 03 Nov 2009 15:46:31 -0500 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090812) |
Hi,
I am trying to understand eigenvector centrality, but I'm clearly doing
something wrong!
I have found a paper [1] that gives two example networks and their
eigenvector centrality values. What is interesting about both these
example networks is that they contain "positive" and "negative"
connections. The paper says that with eigenvector centrality and such
signed networks, it is possible to classify nodes according to the sign
of their centrality.
[1] Phillip Bonacich. 2007. "Some unique properties of eigenvector
centrality". Social Networks 29. Pages 555-564.
For the first network (figure 3A in the paper), iGraph produces a
(scaled) version of the published results. I'm very happy with that.
(The results correctly contain both positive and negative signs.)
However, if I trial the other network (figure 3B), iGraph's results all
have the same (negative) sign. This is very different from the
published results where half the vertices have centrality scores that
are negative while the other half are positive. I have checked the
published results and the file that I hand-wrote by executing
Network>Centrality>Eigenvector in UCINET. UCINET produces a (scaled)
version of the published results.
I have attached the two Pajek-formatted network files. The published
eigenvector centrality results are:
Node 3A 3B
1 0.366 0.568
2 0.798 1.024
3 1.367 1.276
4 -1.088 -1.276
5 -1.000 -1.024
6 -1.088 -0.568
The code that I used is copied below. It writes out the centrality
scores to x_fact and y_fact for display in Pajek.
What have I done wrong?! Thanks in advance for your assistance!
Matthew
// Eigenvector
centrality
igraph_vector_t lEigenvector;
igraph_integer_t lNumVertices = igraph_vcount(&lGraph);
igraph_vector_init(&lEigenvector, lNumVertices);
igraph_arpack_options_t lArpackOptions;
igraph_arpack_options_init(&lArpackOptions);
// Get edge
weights
igraph_vector_t lEdgeWeights;
igraph_vector_init(&lEdgeWeights, 0);
igraph_cattribute_EANV(&lGraph, "weight",
igraph_ess_all(IGRAPH_EDGEORDER_ID), &lEdgeWeights);
// Calculate eigenvector centrality
igraph_eigenvector_centrality(&lGraph,
&lEigenvector,
NULL, // No eigenvalue
required
0, // Do not scale
result
&lEdgeWeights, // Edges weights are
provided
&lArpackOptions);
// Set attribute values
igraph_cattribute_VAN_setv(&lGraph, "xfact", &lEigenvector);
igraph_cattribute_VAN_setv(&lGraph, "yfact", &lEigenvector);
// Write Pajek-formatted
file
FILE* lOutFile;
lOutFile = fopen("eigenvector.net","wb");
if (!lOutFile) cerr << "Failed to open file for writing." << endl;
igraph_write_graph_pajek(&lGraph, lOutFile);
fclose(lOutFile);
*Vertices 6
1 "One" 0.95 0.25
2 "Two" 0.75 0.05
3 "Three" 0.5 0.25
4 "Four" 0.05 0.25
5 "Five" 0.05 0.95
6 "Six" 0.5 0.95
*Edges
1 2 1
2 3 1
3 4 -1
3 6 -1
4 5 1
5 6 1
*Vertices 6
1 "One" 0.05 0.5
2 "Two" 0.2 0.05
3 "Three" 0.8 0.05
4 "Four" 0.95 0.5
5 "Five" 0.8 0.95
6 "Six" 0.2 0.95
*Edges
1 2 1
2 3 1
3 4 -1
4 5 1
5 6 1
- [igraph] Eigenvector centrality,
Matthew Walker <=