I have an undirected graph and I'd like for all relevant edges (to and from a particular node) to be highlighted when I click on a node.
library(visNetwork)
nodes = data.frame( id = 1:2 , label = paste('Label', 1:2) )
edges = data.frame( from = 1 , to = 2 )
visNetwork( nodes , edges ) %>%
visOptions( highlightNearest = list( enabled = TRUE , degree = 0 ) )
The above code works just fine when I click on node 1:
However, no edge is highlighted when I click on node 2:
This is obviously because highlightNearest
is only highlighting edges from
a selected node. Is there an option to change this behavior so that highlightNearest
assumes an undirected graph?
I suspect that my question might be what the author of this SO post was getting at. However, I think that my question is more precise, in my humble opinion.