Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as.igraph.Node

Convert a data.tree structure to an igraph network


Description

This requires the igraph package to be installed. Also, this requires the names of the Nodes to be unique within the data.tree structure.

Usage

as.igraph.Node(
  x,
  vertexAttributes = character(),
  edgeAttributes = character(),
  directed = FALSE,
  direction = c("climb", "descend"),
  ...
)

Arguments

x

The root Node to convert

vertexAttributes

A vector of strings, representing the attributes in the data.tree structure to add as attributes to the vertices of the igraph

edgeAttributes

A vector of strings, representing the attributes in the data.tree structure to add as edge attributes of the igraph

directed

Logical scalar, whether or not to create a directed graph.

direction

when converting to a network, should the edges point from root to children ("climb") or from child to parent ("descend")?

...

Currently unused.

Value

an igraph object

See Also

AreNamesUnique

Examples

data(acme)
library(igraph)
ig <- as.igraph(acme, "p", c("level", "isLeaf"))
plot(ig)

data.tree

General Purpose Hierarchical Data Structure

v1.0.0
GPL (>= 2)
Authors
Russ Hyde [ctb] (improve dependencies), Chris Hammill [ctb] (improve getting), Facundo Munoz [ctb] (improve list conversion), Markus Wamser [ctb] (fixed some typos), Pierre Formont [ctb] (additional features), Kent Russel [ctb] (documentation), Noam Ross [ctb] (fixes), Duncan Garmonsway [ctb] (fixes), Christoph Glur [aut, cre] (R interface)
Initial release
2020-07-31

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.