**What is Steiner Tree?**

Given a graph and a **subset **of vertices in the graph, a steiner tree spans though the given subset. The Steiner Tree may contain some vertices which are not in given subset but are used to connect the vertices of subset.

The given set of vertices is called * Terminal Vertices* and other vertices that are used to construct Steiner tree are called

*.*

**Steiner vertices****is to find the minimum cost Steiner Tree. See below for an example.**

The Steiner Tree Problem

The Steiner Tree Problem

**Spanning Tree vs Steiner Tree**

Minimum Spanning Tree is a minimum weight tree that spans through **all **vertices.

If given subset (or terminal) vertices is equal to set of all vertices in Steiner Tree problem, then the problem becomes Minimum Spanning Tree problem. And if the given subset contains only two vertices, then it shortest path problem between two vertices.

Finding out Minimum Spanning Tree is polynomial time solvable, but Minimum Steiner Tree problem is NP Hard and related decision problem is NP-Complete.

**Applications of Steiner Tree**

Any situation where the task is minimize cost of connection among some important locations like VLSI Design, Computer Networks, etc.

**Shortest Path based Approximate Algorithm**

Since Steiner Tree problem is NP-Hard, there are no polynomial time solutions that always give optimal cost. Therefore, there are approximate algorithms to solve the same. Below is one simple approximate algorithm.

1) Start with a subtree T consisting of one given terminal vertex 2) While T does not span all terminals a) Select a terminal x not in T that is closest to a vertex in T. b) Add to T the shortest path that connects x with T

The above algorithm is (2-2/n) approximate, i.e., it guarantees that solution produced by this algorithm is not more than this ration of optimized solution for a given graph with n vertices. There are better algorithms also that provide better ratio. Refer below reference for more details.

**References:**

www.cs.uu.nl/docs/vakken/an/teoud/an-steiner.ppt

This article is contributed by **Shivam Gupta**. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Applications of Minimum Spanning Tree Problem
- Build a segment tree for N-ary rooted tree
- Count the nodes of the tree which make a pangram when concatenated with the sub-tree nodes
- Ford-Fulkerson Algorithm for Maximum Flow Problem
- Stable Marriage Problem
- Travelling Salesman Problem | Set 1 (Naive and Dynamic Programming)
- Travelling Salesman Problem | Set 2 (Approximate using MST)
- Channel Assignment Problem
- K Centers Problem | Set 1 (Greedy Approximate Algorithm)
- Hungarian Algorithm for Assignment Problem | Set 1 (Introduction)
- Two Clique Problem (Check if Graph can be divided in two Cliques)
- Max Flow Problem Introduction
- 2-Satisfiability (2-SAT) Problem
- A Peterson Graph Problem
- Water Jug problem using BFS
- Water Connection Problem
- Problem Solving for Minimum Spanning Trees (Kruskal’s and Prim’s)
- Level Ancestor Problem
- Travelling Salesman Problem implementation using BackTracking
- Implementing Water Supply Problem using Breadth First Search