15

I'm unable to understand the difference between a tree and a spanning tree. A tree is a graph that is connected and contains no circuits. A spanning tree of a graph G is a tree that contains every node of G. So what is the difference!?!

RobPratt
  • 50,938
Jack Twain
  • 1,234
  • 5
  • 17
  • 32

5 Answers5

20

"Spanning" is the difference: a spanning subgraph is a subgraph which has the same vertex set as the original graph. A spanning tree is a tree (as per the definition in the question) that is spanning.

For example:

enter image description here

has the spanning tree

enter image description here

whereas the subgraph

enter image description here

is not a spanning tree (it's a tree, but it's not spanning). The subgraph

enter image description here

is also not a spanning tree (it's spanning, but it's not a tree).

  • To complete the list, you might add a spanning subgraph that is not a tree - for example the cyclic graph formed by the outer edges – Hagen von Eitzen Feb 05 '14 at 10:47
  • Sure, why not. (Added.) – Rebecca J. Stones Feb 05 '14 at 10:53
  • 1
    @RebeccaJ.Stones can we conclude Every Spanning tree is a tree while every tree is not necessarily a spanning tree – laura Oct 03 '17 at 06:45
  • 1
    We can conclude the first part (every spanning tree is a tree) by definition. The second part sounds a bit weird. Trivially, every tree is a spanning tree of itself, but we usually think of a graph G and look at spanning trees of G (and not just think of "spanning trees" by themselves). – Rebecca J. Stones Oct 03 '17 at 07:26
2

A tree is just a type of graph (connected and no cycles).

You can only say that $G$ is a spanning graph of $H$: it's more of a relation between graphs, which states a few things at the same time: $G$ is a subgraph of $H$ (i.e. it has a subset of the vertices and a subset of the edges), $G$ is a tree when considered on its own (as above), and it is spanning (the set of vertices of $G$ actually equals the vertices of $H$). So it says three things, of which two are about the relation between them. Saying it is a tree is simpler and has less information.

Henno Brandsma
  • 250,824
1

The only difference is the word 'spanning', a kind of 'skeleton' which is just capable to hold the structure of the given graph $G$. Infact, there may be more than one such 'skeletons' in a given graph but a tree $T$ has the only one i.e. $T$ itself.

Nitin Uniyal
  • 8,108
0

Spanning tree is a maximal tree subgraph or maximal tree of graph G (i.e. A tree T is said to be a spanning tree of a connected graph G if T is a subgraph of G and T contain all vertices of G.

-1

A tree and a spanning tree are related concepts in graph theory, but they have different meanings.

  1. Tree:

    • In graph theory, a tree is an undirected graph that is connected and acyclic, meaning there are no cycles (closed loops) in the graph.
    • A tree with n vertices will have exactly n-1 edges, and there is a unique path between any pair of vertices.
    • Trees are commonly used in computer science and algorithms for hierarchical structures, such as binary trees and search trees.
  2. Spanning Tree:

    • A spanning tree of a connected, undirected graph is a subgraph that includes all the vertices of the original graph while still being a tree.
    • In other words, a spanning tree is a tree that spans or covers all the vertices of the original graph.
    • Spanning trees are useful in network design, where they can be employed to ensure connectivity without forming cycles.

In summary, while a tree is a specific type of graph with no cycles, a spanning tree is a subgraph of a connected graph that retains connectivity by spanning all the vertices. Every connected graph has at least one spanning tree.

  • 1
    Was this AI-generated? (It's not a very good answer either way; mostly you're just stating facts about trees and spanning trees without filtering for relevance and without addressing the root confusion. But it also seems like the sort of not-very-good answer that ChatGPT might give.) – Misha Lavrov Feb 29 '24 at 03:09