title: Fastest way to get vector of parents in a tree graph
body: <p>Given a tree graph like this:</p>
  
  <pre><code>library(igraph)
  g &lt;- sample_pa(1000, power=1, directed=FALSE)
  nodes &lt;- V(g)[-1] # exclude root node since it has no parent.
  </code></pre>
  
  <p>What is the <em>fastest</em> way to get the parent of every node? </p>
  
  <p>I currently use this:</p>
  
  <pre><code>parents &lt;- unlist(adjacent_vertices(g, nodes, mode = c("out"))) 
  </code></pre>
  
  <p>but it is actually one of my code bottlenecks since I need to do this for thousands of graphs (around 50 vertices each). </p>