I have a data.frame with 2 columns: Node A, Node B. Each entry in the frame implies an edge in a graph between node A and B.
There must be a nice one-liner to convert this data.frame into an adjacency list. Any hints?
Since you tagged this igraph, how about using built in functionality?
> g <- graph.data.frame( edges )
> adjlist <- get.adjedgelist(g)
Only caveat is the vertices are zero indexed, which will be changing with igraph 0.6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With