SachaEpskamp / qgraph

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

centralityPlot:An error has occurred in node Strength. #67

Closed yazawaninico00000 closed 1 year ago

yazawaninico00000 commented 1 year ago

I set up a simple network as follows: library(igraph) library(qgraph) g <- graph_from_literal(1-2, 1-3, 2-3, 2-4, 3-5, 4-5,4-6, 4-7, 5-6, 6-7)

However, the following problems occur when I want to use centralityPlot

centralityPlot(g, scale = "relative", include ="Degree") #This code runs normally. centralityPlot(g, scale = "relative", include ="Strength") # This code cannot run, and an error is reported:Error in combine_vars().....

Then I tried to use strength (g) to get the strength of the nodes. strength(g) This code outputs the strength of each node. I want to know why centralityPlot (g, scale="relative", include="Strength") reports error. I'm very grateful for some advice.

SachaEpskamp commented 1 year ago

Hi! Node strength is simply called degree in the case of an unweighted graph. So the code you have with degree already works.