my presentation minimum spanning tree
DESCRIPTION
Networking models for quantitative methods of researchTRANSCRIPT
MINIMUM SPANNINGA Networking Model Report for
DPA 702 QUANTITATIVE METHODS OF
RESEARCHBy:
ALONA M. SALVACebu Technological University
Topics
Definitions & Networking Basics
MST AlgorithmsKruskalReverse DeletePrim
Brief HistoryImportance
Definitions & Networking Basics
Network models are created from two major building blocks: arcs (sometimes called edges), which are
connecting lines, and nodes, which are the connecting points
for the arcs. A graph is a structure that is built by
interconnecting nodes and arcs. A directed graph (often called a digraph)
is a graph in which the arcs have specified directions, as shown by arrowheads.
Finally, a network is a graph (or more commonly a digraph) in which the arcs have an associated flow.
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010
Networking Basics
http://www.sce.carleton.ca/faculty/chinneck/po.html
A network is an arrangement of paths connected at various points, through which items move.
Introduction to Management Science, 9th ed, Bernard W. Taylor III, 2006
Definitions & Networking BasicsSome further definitions associated with graphs and networks:
chain: a sequence of arcs connecting two nodes i and j. For example, in Figure 8.1(a), we might connect nodes A and E via the chains ABCE or ADCE.
path: a sequence of directed arcs connecting two nodes. In this case, you must respect the arc directions. For example, in Figure 8.1(b), a path from A to E might be ABDE, but the chain ABCE is not a path because it traverses arc BC in the wrong direction.
cycle: a chain that connects a node to itself without any retracing.
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
Definitions & Networking Basicsconnected graph (or connected network):
has just one part. In other words you can reach any node in the graph or network via a chain from any other node.
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
tree: a connected graph having no cycles. Some examples are shown in Figure 8.2(a).
Definitions
spanning tree: normally a tree selected from among the arcs in a graph or network so that all of the nodes in the tree are connected.
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
Definitionsflow capacity: an upper (and sometimes
lower) limit on the amount of flow in an arc in a network. For example, the maximum flow rate of water in a pipe, or the maximum simultaneous number of calls on a telephone connection.
source (or source node): a node which introduces flow into a network. This happens at the boundary between the network under study and the external world.
sink (or sink node): a node which removes flow from a network. This happens at the boundary between the network under study and the external world.
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
The Minimum Spanning Tree Problem
Given a graph in which the arcs are labeled with the distances between the nodes that they connect, find a spanning tree which has the minimum total length.
NO CYCLES ALLOWED!!ALGORITHMS – a problem solving
procedure following a set of rulesCycle- the nodes are connected by
more than one edge.
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
Steps of the minimal spanning tree solution method:
1. Select any starting node (conventionally, node 1 is selected).
2. Select the node closest to the starting node to join the spanning tree.
3. Select the closest node not presently in the spanning tree.
4. Repeat step 3 until all nodes have joined the spanning tree.Introduction to Management Science, 9th ed, Bernard W. Taylor III, 2006
Practical Optimization: A Gentle Introduction, John W. Chinneck, 2010http://www.sce.carleton.ca/faculty/chinneck/po.html
What is an MST Algorithm
An MST algorithm is a way to show the shortest distance
There are many different algorithms:KruskalReverse DeletePrim
Introduction to Management Science, 9th ed, Bernard W. Taylor III, 2006
KRUSKAL’S ALGORITHM
1. Pick out the smallest edges
2. Repeat Step 1 as long as the edges selected does not create a cycle
3. When all nodes have been connected, you are done
http://www.slideshare.net/zhaokatherine/minimum-spanning-tree
REVERSE-DELETE ALGORITHM
This is the opposite of Kruskal’s algorithm
1. Start with all edges2. Delete the longest edge3. Continue deleting longest
edges as long as all nodes are connected and no cycles are formed
http://www.slideshare.net/zhaokatherine/minimum-spanning-tree
PRIM’S ALGORITHM
1. Pick out a nod2. Pick out the shortest
edge that is connected to your tree so far, as long as it doesn’t create a cycle
3. Continue this until all nodes are covered
http://www.slideshare.net/zhaokatherine/minimum-spanning-tree
17
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
The execution of Kruskal's algorithm (Moderate part)
•The edges are considered by the algorithm in sorted order by weight.
•The edge under consideration at each step is shown with a red weight number.
18
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
19
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
20
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
21
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
22
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
23
Prim's algorithm(basic part)
MST_PRIM(G,w,r)1. A={}2. S:={r} (r is an arbitrary node in V)3. Q=V-{r}; 4. while Q is not empty do {5 take an edge (u, v) such that (1) u S and v
Q (v S ) and (u, v) is the shortest edge satisfying (1)
6 add (u, v) to A, add v to S and delete v from Q
}
24
Prim's algorithm
MST_PRIM(G,w,r)1 for each u in Q do2 key[u]:=∞3 parent[u]:=NIL4 key[r]:=0; parent[r]=NIL;5 QV[Q]6 while Q!={} do7 u:=EXTRACT_MIN(Q); if parent[u]Nil print
(u, parent[u])8 for each v in Adj[u] do9 if v in Q and w(u,v)<key[v]10 then parent[v]:=u11 key[v]:=w(u,v)
25
Grow the minimum spanning tree from the root vertex r.
Q is a priority queue, holding all vertices that are not in the tree now.
key[v] is the minimum weight of any edge connecting v to a vertex in the tree.
parent[v] names the parent of v in the tree.
When the algorithm terminates, Q is empty; the minimum spanning tree A for G is thus A={(v,parent[v]):v∈V-{r}}.
Running time: O(||E||lg |V|).
26
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
The execution of Prim's algorithm(moderate part)
the root vertex
27
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
28
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
29
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
30
a
b
h
c d
e
fg
i
4
8 7
9
10
144
2
2
6
1
7
11
8
Bottleneck spanning tree: A spanning tree of G whose largest edge weight is minimum over all spanning trees of G. The value of the bottleneck spanning tree is the weight of the maximum-weight edge in T.
Theorem: A minimum spanning tree is also a bottleneck spanning tree. (Challenge problem)
MST’s
Kruskal (1956) and Prim (1957)
MST’s makes our life easier and we save money by using short paths
MST’s was first seen in Poland, France, the Czech Republic Slovakia, and Czechoslovakia
IMPORTANCE OF MST’S
1. We need it in computer science because it prevent loops in a switched network with redundant paths
2. It is one of the oldest and most basic graphs in theoritical computer science
http://www.slideshare.net/zhaokatherine/minimum-spanning-tree
Why we like MST’s
1. MST’s are fun to work with
2. It helps us find the shortest route
“The shortest distance between two people is a
sMILE.”