xTB2IG: Function to convert an igraph from one or two tibbles

View source: R/xTB2IG.r

xTB2IGR Documentation

Function to convert an igraph from one or two tibbles

Description

xTB2IG is supposed to convert an igraph from one or two tibbles.

Usage

xTB2IG(edges, nodes = NULL, directed = FALSE, intersected = NULL)

Arguments

edges

a tibble or data frame for edge attributes

nodes

a tibble or data frame for node attributes. It can be NULL

directed

a logic specifying whether to create a directed graph. By default it is false

intersected

a logic or NULL specifying whether to restrict to only the intersected vertices (from input nodes and edges). By default it is NULL; it will be forced true (if the input nodes do not contain all vertices in the input edges); however, the input nodes can contain vertices not in the input edges. It only works when the input nodes are not NULL

Value

an igraph object

Note

none

See Also

xTB2IG

Examples

set.seed(825)
ig <- sample_pa(20)
V(ig)$name <- seq(1,vcount(ig))
ig %>% xIG2TB('edges') -> edges
ig %>% xIG2TB('nodes') -> nodes

xTB2IG(edges, nodes) -> g

# nodes do not cointain all vertices in the edges
nodes[1:10,] -> nodes2
xTB2IG(edges, nodes2) -> g2

hfang-bristol/XGR documentation built on Feb. 4, 2023, 7:05 a.m.