data.tree structure to an igraph networkR/node_conversion_igraph.R
as.igraph.Node.RdThis requires the igraph package to be installed.
Also, this requires the names of the Nodes to be unique within
the data.tree structure.
The root Node to convert
A vector of strings, representing the attributes
in the data.tree structure to add as attributes to the vertices of the igraph
A vector of strings, representing the attributes
in the data.tree structure to add as edge attributes of the igraph
Logical scalar, whether or not to create a directed graph.
when converting to a network, should the edges point from root to children ("climb") or from child to parent ("descend")?
Currently unused.
an igraph object
AreNamesUnique
data(acme)
library(igraph)
#>
#> Attaching package: ‘igraph’
#> The following object is masked from ‘package:modeltools’:
#>
#> clusters
#> The following objects are masked from ‘package:ape’:
#>
#> degree, edges, mst, ring
#> The following objects are masked from ‘package:stats’:
#>
#> decompose, spectrum
#> The following object is masked from ‘package:base’:
#>
#> union
ig <- as.igraph(acme, "p", c("level", "isLeaf"))
plot(ig)