Read this lesson as text

Spanning Trees

Graph Theory · Axiom Academy

Understanding how to extract tree structures from connected graphs Is a tree (connected and acyclic) In simpler terms, a spanning tree "spans" all vertices by selecting just enough edges to keep everything connected while avoiding cycles. Watch the animation to see how we extract a spanning tree from a graph: 2. Every Connected Graph Has a Spanning Tree An important theorem in graph theory states that every connected graph contains at least one spanning tree . This is guaranteed because we can always remove edges that create cycles until we're left with a tree structure. The animation demonstrates the cycle-removal process, showing how we can systematically eliminate cycles while preserving connectivity: There are two primary algorithmic approaches to finding spanning trees in a graph: Depth-First Search (DFS): Explores as far as possible along each branch before backtracking. Creates a spanning tree by following edges in depth-first order. Breadth-First Search (BFS): Explores all neighbors at the current depth before moving deeper. Creates a spanning tree by following edges in breadth-first order. Watch the animation to see DFS building a spanning tree step by step: A single graph can have many different spanning trees. The number can grow exponentially with the size of the graph!

This is the written version of the interactive lesson above. See the full Graph Theory course.