Error-Not an igraph object

Hi- I am trying to do a principle component analysis for measures of centrality and on my last line of code below it returns the error "Error in calculate_centralities(Advice_Network, include = pr_cent[7, 11, :
The input is not an igraph object or may not be connected." - Note that I have checked the class of the Advice_ Network by doing class(Advice_Network) and it returned that it is igraph.

library(igraph)
my_data <- read.csv(file.choose(), header=TRUE, row.names=1)
my_advicematrix <- as.matrix(my_data)
Advice_Network <- graph.adjacency(my_advicematrix,mode="directed",diag=FALSE)
Advice_Network
library(CINNA)
data("Advice_Network")
plot (Advice_Network)
pr_cent <-proper_centralities(Advice_Network)
calculate_centralities(Advice_Network, include = pr_cent[7,11,15]) %>%
pca_centralities(scale.unit = TRUE)

That implies it's not connected.

do you know how to fix that?

Have you tried visualising your igraph?

I did and it looks quite strange- I'm not sure how to make all the nodes connected because with the data there are some nodes that just aren't chosen.

I don't know what you are doing so it's hard to advise you. Presumably you could eliminate the minority nodes that don't connect the majority, and calculate statistics on that connected group.

thank you for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.