Macaulay2 » Documentation
Packages » Graphs :: spanningForest
next | previous | forward | backward | up | index | toc

spanningForest -- constructs a spanning forest of a graph

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:

  • spanningForest(Graph)

For the programmer

The object spanningForest is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/Graphs.m2:5220:0.