Custom visOptions for custom highlightNearest

netout <- visNetwork(net$nodes,net$edges) %>% visEdges(arrows = 'to') %>%
#visOptions(highlightNearest = FALSE, selectedBy = list(variable = "group", multiple = T)) %>%
# visOptions(highlightNearest = highlightNearest, collapse = collapse) %>%
visOptions(highlightNearest = list(enabled = TRUE, labelOnly = FALSE, degree = 1)) %>%
visNodes(borderWidthSelected = 1) %>%
visIgraphLayout(smooth = TRUE) %>%
visLegend(addNodes = net$lnodes, addEdges = net$ledges, useGroups = FALSE) %>%
visEvents(doubleClick = "function(properties) {window.open(this.body.data.nodes._data[properties.nodes[0]].link);}")

I am using visnetwork for a shiny application. I would like to customize the degree that nearest nodes are highlighted given the groups, that is, I want different different degrees to be considered for selecting nodes of different groups, say for example, neighbors of neighbors to be highlighted (degree=2) when select a node from group 2, and only neighrbors are highlighted (degree=1) when selecting a node from group 1.

Thanks a lot

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.