I need to create a datatable with both node names and their eigenvector centralities but the problem is that I cannot extract the node names and I use:
#CENTRALITY
library(igraph)
library(magrittr)
library(visNetwork)
library(data.table)
#Load dataset
data(lesmis)
#Nodes
nodes <- as.data.frame(lesmis[2])
colnames(nodes) <- c("id", "label")
#id has to be the same like from and to columns in edges
nodes$id <- nodes$label
#Edges
edges <- as.data.frame(lesmis[1])
colnames(edges) <- c("from", "to", "width")
#Create graph for Louvain
graph <- graph_from_data_frame(edges, directed = FALSE)
graph <- simplify(graph)
library(DT)
ev<-evcent(graph)$vector
datatable(ev)