igraph, r : unlist node centrality scores for a list of matrices

Viewed 124

I am working with a list of network graphs (i.e., 1000+ adjacency matrices) that I'm analyzing with the igraph package. The graphs are stored in a split file, with each graph having an unique ID.

I have calculated individual nodes' betweenness centrality scores in each respective graph, using the following code:

b <- function (b) betweenness(b, directed = FALSE, normalized = TRUE)
Between <- lapply (listofgraphs, b)

show(Between) #looks like this:

$`35630`           #Graph ID
1676 1741 1750     #Node ID
0    1    0        #Scores

$`35631`
1738 1750 
0     1 

$`35633`
1738 1750 4110 
0    0    0 

Now, what I need is one dataframe with colums for the Graph ID's, Node ID's and the individual scores for betweenness. Like this:

Graph.ID    Node.ID    Betweenness
35630       1676       0
35630       1741       1
35630       1759       0
35631       1738       0
35631       1750       1
35631       1738       0      
35633       1750       0
35633       et cetera .....

I've tried to unlist, rbind and such, but for some reason I can't get this to work. If someone could help me with this that would be amazing!

1 Answers
Related