0

I applied igraph to visualizing a network on a discussion forum.

rt_net <- tbl_graph(nodes = nodes, edges = edges, directed = TRUE)
Error in (function (edges, n = max(edges), directed = TRUE)  : 
  At type_indexededgelist.c:117 : cannot create empty graph with negative number of vertices, Invalid value

When I checked back the matric of edgelist, there is no negative numbers. I also fill in missing value with 0

Ellie YANG
  • 11
  • 3
  • 1
    Can you show us what `nodes` is and what `edges` is? Or at least the first few values? – Joel Apr 10 '19 at 01:49
  • This may help: https://stackoverflow.com/questions/22819258/igraph-error-cannot-create-empty-graph-with-negative-number-of-vertices – Joel Apr 10 '19 at 01:49
  • Hi Joel -- Thanks for the response. Here is the head (nodes) head(nodes) # A tibble: 6 x 3 handle out_degree in_degree 1 1 18 24 2 2 5 1 3 3 44 1 – Ellie YANG Apr 10 '19 at 15:11
  • I suspect it may be due the process of nodes creation as I got an error " Can't join on 'handle' x 'handle' because of incompatible types (factor / integer)" so I transformed the handle like temp_in$handle = as.numeric(temp_in$handle). But for edge creation, no such problem. Could you help me figure it out? Thanks so much. – Ellie YANG Apr 10 '19 at 15:15
  • Hi Joel -- I solved the problem! Changed the node format to character. Thanks! – Ellie YANG Apr 10 '19 at 15:25

0 Answers0