This creates a nctx-graph as a copy of an igraph-graph.
copy_from_igraph(g_i)
g_i | An igraph graph |
---|
The copied nctx graph
Internally, this is a call to
ends(g_i, E(g_i), names = F)
with g_i
being an igraph graph.
Note that only structural information will be copied, i.e. attributes like vertex names or edge weights are not copied.
library(RUnit) library(igraph) library(nctx) file <- system.file("extdata", "bcde.directed.graphml", package="nctx") g_i <- read_graph(file, "graphml") checkTrue(igraph::is_directed(g_i))#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUEfile <- system.file("extdata", "bcde.undirected.graphml", package="nctx") g_i <- read_graph(file, "graphml") checkTrue(!igraph::is_directed(g_i))#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUE#> [1] TRUE