datastorm-open / visNetwork

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

Can't make visNetwork from empty Igraph #409

Closed James-G-Hill closed 2 years ago

James-G-Hill commented 3 years ago

The following:

visNetwork::visIgraph(
  igraph = igraph::make_empty_graph()
)

gives this error:

Error in `$<-.data.frame`(`*tmp*`, "id", value = 1:0) : 
  replacement has 2 rows, data has 0

So unfortunately, I can't create an empty visNetwork when my Shiny application starts with Igraph layouts; this is how I do it with basic visNetwork:

visNetwork::visNetwork(
  nodes = data.frame(id = c()),
  edges = data.frame(from = c(), to = c())
)

I have tried other methods of converting that empty basic visNetwork into Igraph format with visNetwork::visIgraphLayout but that doesn't work either.

bthieurmel commented 2 years ago

Thanks. Fix on dev branch v9.1.0.