SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

Question with getting zero closeness centralities #55

Closed djkimhyu closed 3 years ago

djkimhyu commented 3 years ago

Hi I'm a R beginner and doing some study of network analysis of 30 item survey, thanks to great help from your cookbook website. I'm not sure if i should write my question on qgraph, but I couldn't find other place to get information.

I have a problem with computing closeness centrality. I got my centrality strength, betweenness centrality graph. Also I got my closeness centrality graph with warning messages "Removed 4 rows containing missing values (geom_point)", with missing four in the graph(as attached file). The real problem is if I compute closeness centrality with 'centRes$Closeness', I get all zeros as below even though I got non-zero closeness centralities except four items. capture

GDS.1 GDS.2 GDS.3 GDS.4 GDS.5 GDS.6 GDS.7 GDS.8 GDS.9 GDS.10 GDS.11 0 0 0 0 0 0 0 0 0 0 0 GDS.12 GDS.13 GDS.14 GDS.15 GDS.16 GDS.17 GDS.18 GDS.19 GDS.20 GDS.21 GDS.22 0 0 0 0 0 0 0 0 0 0 0 GDS.23 GDS.24 GDS.25 GDS.26 GDS.27 GDS.28 GDS.29 GDS.30 0 0 0 0 0 0 0 0

my made my codes as below: library("IsingFit") library("qgraph") library("bootnet") data=read.csv("dementia.csv") Res <- IsingFit(as.matrix(data),gamma = 0.25, plot=FALSE) Graph_Ising2 <- qgraph(Res$weiadj, layout = "spring") centRes$OutDegree centRes$Betweenness centRes$Closeness centralityPlot(Graph_Ising2, scale="raw", include = c("Strength", "Betweenness", "Closeness"), orderBy="Strength")

I can't figure out why all closeness centralities are zero inspite of other meaningful values. Do I have missing points?

Thank you, Kim

SachaEpskamp commented 3 years ago

Closeness is 0 for all nodes when there are separate clusters, because all nodes have infinite shortest path lengths to all other nodes. The centrality' function will report this. ThecentralityPlotfunction instead computes closeness for the giant component. These values can also be obtained withcentralityTable`.