next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Graphs :: spanningForest

spanningForest -- constructs a spanning forest of a graph

Synopsis

Description

A graph is a forest if it is a disjoint collection of trees. A graph is a tree if any two vertices are connected by a unique path of edges. A spanning forest is a forest that spans all the vectors of G using edges of G.

i1 : G = cycleGraph 5;
i2 : spanningForest G

o2 = Graph{0 => {1, 4}}
           1 => {0, 2}
           2 => {1, 3}
           3 => {2}
           4 => {0}

o2 : Graph

See also

Ways to use spanningForest :

For the programmer

The object spanningForest is a method function.