I have a Dataset which looks like this:
PostID UserID ReplyTo
1 11 NA
2 12 1
3 11 2
4 13 NA
5 12 4
I want to have a directed Graph with the Edges: 12->11, 11->12, 12->13
The Idea is that ad the End i'm capable of having a list of UserID's to which i add the Different Centralities.
The way i tried it i was only capable of producing a graph between the PostID's and not the UserID's.
library(igraph)
D <- data.frame(Data$PostID, Data$ReplyTo)
FinalEdges<-D[complete.cases(D),]
FinalNetwork <- graph.data.frame(FinalEdges, directed = TRUE)
plot(FinalNetwork, vertex.label = V(FinalNetwork)$PostID)
For the Different Centralities i use:
DegreeCentrality<-degree(FinalNetwork)
ClosenessCentrality<-closeness(FinalNetwork)
BetweennessCentrality<-betweenness(FinalNetwork)
which i the would like to add to a list of users.
At The End i would like to have A List of Users and their Centralities
UserID, DegreeCentrality, Closeness Centrality, BetweennessCentrality
11
12
13