Working off @kaedonkers and @knapply's examples above, as well as @Bryan Shalloway's comment that these didn't work when specifying a base color for edges, I backed into the solution over here, with the key being the algorithm
and bidirectional degree
specifications within highlightNearest
library(igraph)
g <- graph("Zachary")
library(visNetwork)
vis_g <- toVisNetworkData(g)
visNetwork(vis_g$nodes, vis_g$edges) %>%
visIgraphLayout(layout = "layout_with_fr") %>%
visNodes(color = "blue") %>%
visEdges(color="blue") %>% # this causes prior solutions to not work
visOptions(highlightNearest = list(enabled = TRUE,
labelOnly = FALSE, hover = TRUE,
# but these two options fix it
algorithm="hierarchical",
degree=list(from=1, to=1)
),
nodesIdSelection = list(selected = 6))
Giving us this: