title: tidygraph and igraph - build graph from dataframe discrepancy
body: <p>I can build a graph object in igraph from two dataframes without problems. When I try do the same in tidygraph I get errors. Let me demonstrate. First I load my source data (data from a message board):</p>
  
  <pre><code>library(dplyr)
  library(tidyr)
  library(tidygraph)
  library(lubridate)
  library(iterpc)
  library(igraph)
  
  df &lt;- data.frame(author_id = c(2,4,8,16,4,8,2,256,512,8),
               topic_id = c(101,101,101,101,301,301,501,501,501,501),
               time = as.POSIXct(c("2011-08-16 20:20:11", "2011-08-16 21:10:00", "2011-08-17 06:30:10",
                                   "2011-08-17 10:08:32", "2011-08-20 22:23:01","2011-08-20 23:03:03",
                                   "2011-08-25 17:05:01", "2011-08-25 19:15:10",  "2011-08-25 20:07:11",
                                   "2011-08-25 23:59:59")),
               vendor = as.logical(c("FALSE", "FALSE", "TRUE", "FALSE", "FALSE",
                                     "TRUE", "FALSE", "FALSE", "FALSE", "TRUE"))) 
  </code></pre>
  
  <p>Next, I create a unique node list (people who post things on a message board):</p>
  
  <pre><code>node &lt;- df %&gt;% distinct(author_id, vendor) %&gt;% rename(id = author_id) %&gt;% mutate(vendor = as.numeric(vendor))
  </code></pre>
  
  <p>Then, my edge list (people connected via a discussion thread (topic)):</p>
  
  <pre><code>edge &lt;- df %&gt;% 
    group_by(topic_id) %&gt;% 
    do(data.frame(getall(iterpc(table(.$author_id), 2, replace =TRUE)))) %&gt;%
    filter(X1 != X2) %&gt;% rename(from = X1, to = X2) %&gt;% select(to, from, topic_id)
  </code></pre>
  
  <p>Using igraph I can create this graph object:</p>
  
  <pre><code>test_net &lt;- graph_from_data_frame(d = edge, directed = F, vertices = node)
  plot(test_net)
  </code></pre>
  
  <p>This looks good. Now I try do same with tidygraph:</p>
  
  <pre><code>tidy_net &lt;- tbl_graph(nodes = node, edges = edge, directed = F)
  Error in add_vertices(gr, nrow(nodes) - gorder(gr)) : At type_indexededgelist.c:369 : cannot add negative number of vertices, Invalid value
  </code></pre>
  
  <p>Yikes! However, when I import the igraph object into tidygraph:</p>
  
  <pre><code>tidy_net &lt;- as_tbl_graph(test_net)
  plot(tidy_net)
  </code></pre>
  
  <p>All works! What is going on? Please help.</p>