Testing flatness of a graph in R

Is there a way to check if a network graph is flat in R? I looked at igraph, but to no avail.

I know that I can use MATLAB with the BGL toolkit, but I want to know if anyone tried it in R.

+4
source share
1 answer

The RBGL package inside the bioconductor has what you are looking for. RBGL provides an interface to the Boost library for graph analysis (C ++)

source("https://bioconductor.org/biocLite.R")
biocLite("RBGL")

library(RBGL)
library(igraph)

set.seed(1234)
g <- erdos.renyi.game(20, 1/5) ##Make an igraph graph
plot(g)

g <- as_graphnel(g) ## Convert igraph object to graphNEL object for planarity testing
boyerMyrvoldPlanarityTest(g)

# [1] FALSE

g <- erdos.renyi.game(20, 1/8)
plot(g)

g <- as_graphnel(g)
boyerMyrvoldPlanarityTest(g)
# [1] TRUE

Unplanar Count

Non-planar

Flat graph

PLanar

+3
source

Source: https://habr.com/ru/post/1663108/


All Articles