Docsity

Minimum Spanning Trees - Data Structures - Lecture Slides, Slides of Data Structures and Algorithms

Partial preview of the text

Download Minimum Spanning Trees - Data Structures - Lecture Slides and more Slides Data Structures and Algorithms in PDF only on Docsity!

Minimum Spanning Trees

In the design of electronic circuitry, it is often necessary to make the pins of several components electrically equivalent by wiring them together. To interconnect a set of n pins, we can use an arrangement of n โ€“ 1 wires, each connecting two pins. Of all such arrangements, the one that uses the least amount of wire is usually the most desirable. We can model this wiring problem with a connected, undirected graph G = ( V , E ), where V is the set of pins, E is the set of possible interconnections between pairs of pins, and for each edge ( u , v ) โˆˆ E , we have a weight w ( u , v ) specifying the cost (amount of wire needed) to connect u and v.

Undirected graph and 3 of its spanning trees

Undirected Graph

Spanning Trees

Finding a spanning tree

  • To find a spanning tree of a graph,

pick a node and call it part of the spanning tree do a search from the initial node: each time you find a node that is not in the spanning tree, add to the spanning tree both the new node and the edge you followed to get to it

An undirected graph Result of a BFS starting from top

Result of a DFS starting from top Docsity.com

Minimizing costs

  • Suppose you want to supply a set of houses (say, in a

new subdivision) with:

  • electric power
  • water
  • sewage lines
  • telephone lines
  • To keep costs down, you could connect these houses

with a spanning tree (of, for example, power lines)

  • However, the houses are not all equal distances apart
  • To reduce costs even further, you could connect the

houses with a minimum-cost spanning tree