datastorm-open / visNetwork

R package, using vis.js library for network visualization
Other
545 stars 125 forks source link

visPhysics stabilization doesn't work #428

Open th206 opened 2 years ago

th206 commented 2 years ago

I have tried various ways to disable the network stabilization but nothing works. For a smaller network the stabilization process doesn't take time but for a large network the stabilization process is never ending. I have also tried stabilization FALSE for single cluster network or more than one cluster network. It doesn't seem to work in any case. Any help is much appreciated.

visPhysics(solver = "forceAtlas2Based",forceAtlas2Based = list(gravitationalConstant = -500)) %>% visPhysics(stabilization = FALSE) %>%

bthieurmel commented 2 years ago

I think it's not a good idea to use one function several times (and so just keep the last one). Can you try something like this :

visPhysics(solver = "forceAtlas2Based",forceAtlas2Based = list(gravitationalConstant = -500),stabilization = FALSE)

th206 commented 2 years ago

Thanks for the suggestion but unfortunately it didn't work. The below code generates single network with two separate cluster. Animation (stabilization) for one cluster (approx 60 nodes) stops immediately but the second cluster (approx 100) nodes keeps animating forever. See attached screenshot. In the circled second cluster, there are mulitple duplicate edges but they are not duplicate as they represent multiple sources to establish that relation.

Screen Shot 2021-12-12 at 9 58 17 AM

output$cy <- renderVisNetwork({ visNetwork(node_ann, network_file,width = "100%",height = "700px", main=paste0("Network (",toupper(keyword),")")) %>% visOptions(highlightNearest = list(enabled =TRUE, degree = 2),nodesIdSelection = TRUE) %>% visInteraction(navigationButtons = TRUE, dragNodes=FALSE, dragView=FALSE,zoomView=FALSE) %>% visGroups(groupname = unique(node_ann$NodeType)[1],color = "green") %>% visGroups(groupname = unique(node_ann$NodeType)[2],color = "blue") })