Learn R Programming

HyperG (version 1.0.0)

is.tree: Test if a graph is a tree or a forest.

Description

Test if a graph is a tree or a forest.

Usage

is.tree(g)
is.forest(g,strict=FALSE)

Arguments

g

a graph.

strict

logical.

Value

a logical.

Details

test whether an undirected graph g is a tree (connected, acyclic) or a forest (disjoing union of trees). The flag strict enforces the strict rule that a forest must contain more than a single tree. The default is to allow for single-tree forests, which is the convention.

Examples

Run this code
# NOT RUN {
   g <- make_tree(10)
	is.tree(g)
	is.forest(g)
	is.forest(g,strict=TRUE)
# }

Run the code above in your browser using DataLab