Spanning Tree via Traversal

Objective

Given a connected graph, the objective of this system is to build a (any) spanning tree of the graph, the intermediate structures can only be trees.

Graph Color Codes

The table below, lists all the colors used in the graph, along with their interpretations.

Node/Edge Color Type
Unselected Node
Selected Node
Unselected Edge
Candidate Edge
Selected Edge

Experiment Setup

In this system, you are provided with a connected graph. You can click on any node to select it. Candidate Edges can be clicked, to add those edge to the sub-graph. Clicking other nodes is not permitted after selecting a node.

Traversal

Starting from a vertex s, visiting each vertex of a graph , and not exploring anything twice. This process is called a graph traversal. The next node to be visited must be an unexplored neighbour of the visited nodes. A graph traversal outputs a spanning tree of the associated graph.

Procedure

Initial: Selecting the first node

  1. Select the first node, to start building the spanning tree.The first node will be the root node of the spanning tree.

Expanding the Spanning Tree

After selecting the first node, you will see spanning tree beside the graph. At this point the tree has just the one selected node. Now, you will observe that the edges connected to the selected node(s) are marked as "candidates" (See the color codes table).

  1. Select any of the candidate edges to add that edge to the spanning tree.
  2. Check if all the nodes are added to the spanning tree. If not, repeat step 1. Otherwise the spanning tree is complete and you will not see any candidate edges any more.

Select any node to add it to the tree.

Graph
Spanning Tree