SachaEpskamp / qgraph

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

Nodes of the same community not displayed next to each other #57

Closed IreneBobevski closed 2 years ago

IreneBobevski commented 2 years ago

Hi Sacha,

I have plotted a graph of the network structure of various psychological symptoms, after using EGA to estimate the network ( my code is below). The EGA identified four distinct communities, as shown in the graph below. In the graph two of the red nodes of Community 1 are shown apart from the rest of the red nodes of this community. Is there a reason for this? Is it possible to plot the graph with all nodes of Community 1 next to each other?

gega.v1 <- EGA(gcombdata.v1, model = "glasso", algorithm = "louvain")

gega_v1_plot <- plot(gega.v1, vsize = 7, layout = "spring", groups = as.factor(gega.v1$wc), labels = colnames(gega_colnames_v1), label.prop=1, label.norm="OOOOOOO")

image

SachaEpskamp commented 2 years ago

The placement algorithm is chaotic, so this can happen. Note that ds_cope is strongly connected to ds_role, so they do form a cluster. You can play around with the repulsion argument of the Fruchterman Reingold algorithm to get different layouts (although I am not sure if that is implemented in the EGA plot method).

IreneBobevski commented 2 years ago

Many thanks Sacha. Decreasing the repulsion slightly from the default of 1 to 0.93 worked very well:

gega_v1_plot <- plot(gega.v1, vsize = 7, layout = "spring", repulsion=0.93, groups = as.factor(gega.v1$wc), labels = colnames(gega_colnames_v1), label.prop=1, label.norm="OOOOOOO")

image