ECOM 2311- Discrete...

41
ECOM 2311- Discrete Mathematics Chapter # 11 : Trees Fall, 2013/2014 ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 1 / 37

Transcript of ECOM 2311- Discrete...

Page 1: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

ECOM 2311- Discrete Mathematics

Chapter # 11 : Trees

Fall, 2013/2014

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 1 / 37

Page 2: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Outline

1 Connectivity

2 Introduction to Trees

3 Applications of Trees

4 Spanning Trees

5 Minimum Spanning Trees

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 2 / 37

Page 3: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

ConnectivityConnectedness in Undirected Graphs

An undirected graph is called connected if there is a path between everypair of distinct vertices of the graph. An undirected graph that is notconnected is called disconnected.

G1 is connected while G2 is not connected.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 3 / 37

Page 4: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

ConnectivityConnectedness in Directed Graphs

A directed graph is strongly connected if there is a path from a to b andfrom b to a whenever a and b are vertices in the graph.

A directed graph is weakly connected if there is a path between every twovertices in the underlying undirected graph.

G is strongly and hence weakly connected while H is weakly connected.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 4 / 37

Page 5: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to Trees

A tree is a connected undirected graph with no simple circuits.

G1 and G2 are trees, because both are connected graphs with no simplecircuits. G3 is not a tree because e, b, a, d , e is a simple circuit in this

graph. Finally, G4 is not a tree because it is not connected.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 5 / 37

Page 6: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to Trees

Forests are graphs containing no simple circuits that are not necessarilyconnected.

An undirected graph is a tree if and only if there is a unique simple pathbetween any two of its vertices.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 6 / 37

Page 7: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to TreesRooted Trees

A rooted tree is a tree in which one vertex has been designated as theroot and every edge is directed away from the root.

The rooted trees formed by designating a to be the root and c to be theroot, respectively, in the tree T

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 7 / 37

Page 8: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to TreesRooted Trees

The tree terminology:

Parent: of v is the unique vertex u such that there is a directededge from u to v .

Child: When u is the parent of v , v is called a child of u.

Siblings: Vertices with the same parent.

Ancestors: of a vertex other than the root are the vertices in thepath from the root to this vertex, excluding the vertex itself andincluding the root.

Descendants: of a vertex v are those vertices that have v as anancestor.

Leaf: A vertex of a rooted tree that has no children.

Internal vertices: Vertices that have children.

Subtree: with a as its root is the subgraph of the tree consisting ofa and its descendants and all edges incident to these descendants.children.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 8 / 37

Page 9: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to TreesRooted Trees

Example: In the rooted tree T (with root a) shown below, find theparent of c , the children of g , the siblings of h, all ancestors of e, all

descendants of b, all internal vertices, and all leaves.

The parent of c is b. The children of g are h, i , and j . The siblingsof h are i and j . The ancestors of e are c , b, and a. Thedescendants of b are c , d , and e. The internal vertices area, b, c , g , h, and j . The leaves are d , e, f , i , k , l , and m.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 9 / 37

Page 10: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to TreesRooted Trees

A rooted tree is called an m-ary tree if every internal vertex has no morethan m children. The tree is called a full m-ary tree if every internalvertex has exactly m children. An m-ary tree with m = 2 is called abinary tree.

T1 is a full binary tree, T2 is a full 3-ary tree, T3 is a full 5-ary tree andT4 is not a full m-ary tree.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 10 / 37

Page 11: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to TreesRooted Trees

An ordered rooted tree is a rooted tree where the children of eachinternal vertex are ordered. if an internal vertex has two children, thefirst child is called the left child and the second child is called the rightchild. The tree rooted at the left child of a vertex is called the leftsubtree of this vertex, and the tree rooted at the right child of a vertexis called the right subtree of the vertex.

The left child of d is f and the right child is g .

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 11 / 37

Page 12: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to TreesProperties of Trees

A tree with n vertices has n − 1 edges.

A full m-ary tree with i internal vertices contains n = mi + 1 vertices.

A full m-ary tree with(i) n vertices has i = (n − 1)/m internal vertices andl = [(m − 1)n + 1]/m leaves,(ii) i internal vertices has n = mi + 1 vertices and l = (m− 1)i + 1 leaves,(iii) l leaves has n = (ml − 1)/(m − 1) vertices and i = (l − 1)/(m − 1)internal vertices.

The level of a vertex v in a rooted tree is the length of the unique pathfrom the root to this vertex. The level of the root is defined to be zero.The height of a rooted tree is the maximum of the levels of vertices.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 12 / 37

Page 13: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Introduction to TreesProperties of Trees

A rooted m-ary tree of height h is balanced if all leaves are at levels h orh − 1.

T1 is balanced, because all its leaves are at levels 3 and 4. However, T2

is not balanced, because it has leaves at levels 2, 3, and 4. Finally, T3 isbalanced, because all its leaves are at level 3.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 13 / 37

Page 14: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesBinary Search Trees

Goal is to implement a searching algorithm that finds itemsefficiently when the items are totally ordered.

Binary search tree is a binary tree in which each child of a vertexis designated as a right or left child, no vertex has more than oneright child or left child.

Each vertex is labeled with a key, which is one of the items.

Vertices are assigned keys so that the key of a vertex is both largerthan the keys of all vertices in its left subtree and smaller than thekeys of all vertices in its right subtree.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 14 / 37

Page 15: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesBinary Search Trees

Example: Form a binary search tree for the words mathematics, physics,geography, zoology, meteorology, geology, psychology, and chemistry(using alphabetical order).

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 15 / 37

Page 16: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesBinary Search Trees

Exercise: Use Algorithm 1 to insert the word oceanography into thebinary search tree in Example 1.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 16 / 37

Page 17: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesDecision Trees

Rooted trees can be used to model problems in which a series ofdecisions leads to a solution.

For instance, a binary search tree can be used to locate items basedon a series of comparisons, where each comparison tells us whetherwe have located the item, or whether we should go right or left in asubtree.

A rooted tree in which each internal vertex corresponds to adecision, with a subtree at these vertices for each possible outcomeof the decision, is called a decision tree.

Example: Suppose there are seven coins, all with the same weight, and acounterfeit coin that weighs less than the others. How many weighingsare necessary using a balance scale to determine which of the eight coinsis the counterfeit one? Give an algorithm for finding this counterfeit coin.Hint: Use the hight relation h = dlogm le where m is the type of the treewhile l is the number of leaves.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 17 / 37

Page 18: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesDecision Trees

There are three possibilities for each weighing on a balance scale.The two pans can have equal weight, the first pan can be heavier, orthe second pan can be heavier.

Consequently, the decision tree for the sequence of weighings is a3-ary tree.

There are at least eight leaves in the decision tree because there areeight possible outcomes.

It follows that the height of the decision tree is at least dlog3 8e = 2.Hence, at least two weighings are needed.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 18 / 37

Page 19: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesDecision Trees

Example: Use a binary tree to sort the following list of numbers 15, 7,24, 11, 27, 13, 18, 19, 9

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 19 / 37

Page 20: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesPrefix Codes

Prefix codes:to encode the codewords so that the bit string for acodeword never occurs as the first part of the bit string for anothercodeword.

For instance, the encoding of e as 0, a as 10, and t as 11 is a prefixcode. A word can be recovered from the unique bit string thatencodes its letters. For example, the string 10110 is the encoding ofate.

A prefix code can be represented using a binary tree, where thecharacters are the labels of the leaves in the tree. The edges of thetree are labeled so that an edge leading to a left child is assigned a 0and an edge leading to a right child is assigned a 1. The bit stringused to encode a character is the sequence of labels of the edges inthe unique path from the root to the leaf that has this character asits label.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 20 / 37

Page 21: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesPrefix Codes

Example: Use the following binary tree with a prefix code to encode thedifferent letters in the tree and to decode the string 11111011100

The encoding is : e by 0, a by 10, t by 110, n by 1110, and s by 1111while 11111011100 will be decoded as sane

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 21 / 37

Page 22: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesPrefix Codes - Huffman Codes

Example: Suppose we want to store a message made of up to5-characters a,b,c,d,e with frequencies {a/20,b/15, c/5, d/15,e/45}.What is the requirement for the fixed-length code and the variable lengthcode for 100 characters message?.

e=1, a=000, b=001, d=010, e=011 and hence for fixed length 300 bitsand for variable length 210 bits.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 22 / 37

Page 23: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Applications of TreesGame Trees

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 23 / 37

Page 24: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Homework [due 17th of Dec].From the text book, Section 10.2, page 665Questions: Q2, Q4 [Part ”2”], Q8, Q20 [Parts a,c], Q22 and Q24.From the text book, Section 10.3, page 675Questions: Q6, Q14, Q26 ,Q34, Q36, Q40, Q42, and Q62.From the text book, Section 10.5, page 716Questions: Q2 and Q6.

Page 25: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesIntroduction

Let G be a simple graph. A spanning tree of G is a subgraph of G that isa tree containing every vertex of G .

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 25 / 37

Page 26: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesIntroduction

Example: Find a spanning tree of the simple graph G shown below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 26 / 37

Page 27: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesIntroduction

Example: IP Multicasting

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 27 / 37

Page 28: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesDepth-First Search

Steps to build a spanning tree using depth-first search.Arbitrarily choose a vertex of the graph as the root.

Form a path starting at this vertex by successively adding vertices andedges, where each new edge is incident with the last vertex in the path anda vertex not already in the path.

Continue adding vertices and edges to this path as long as possible.

If the path goes through all vertices of the graph, the tree consisting ofthis path is a spanning tree.

However, if the path does not go through all vertices, more vertices andedges must be added.

Move back to the next to last vertex in the path, and, if possible, form anew path starting at this vertex passing through vertices that were notalready visited.

Repeat this procedure, beginning at the last vertex visited, moving back upthe path one vertex at a time, forming new paths that are as long aspossible until no more edges can be added.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 28 / 37

Page 29: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesDepth-First Search

Example: Use depth-first search to find a spanning tree for the graph Gshown below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 29 / 37

Page 30: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesDepth-First Search

Example: Use depth-first search to find a spanning tree for the graph Gshown below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 29 / 37

Page 31: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesBreadth-First Search

Steps to build a spanning tree using Breadth-First Search.Arbitrarily choose a vertex of the graph as the root.

Add all edges incident to this vertex.

The new vertices added at this stage become the vertices at level 1 in thespanning tree.

Arbitrarily order them.

Next, for each vertex at level 1, visited in order, add each edge incident tothis vertex to the tree as long as it does not produce a simple circuit.

Arbitrarily order the children of each vertex at level 1.

This produces the vertices at level 2 in the tree.

Follow the same procedure until all the vertices in the tree have beenadded.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 30 / 37

Page 32: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Spanning TreesBreadth-First Search

Example: Use breadth-first search to find a spanning tree for the graphG shown below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 31 / 37

Page 33: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesPrim’s Algorithm

A minimum spanning tree in a connected weighted graph is a spanningtree that has the smallest possible sum of weights of its edges.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 32 / 37

Page 34: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesPrim’s Algorithm

Example: Use Prim’s algorithm to design a minimum-costcommunications network connecting all the computers represented by thegraph below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 33 / 37

Page 35: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesPrim’s Algorithm

Example: Use Prim’s algorithm to design a minimum-costcommunications network connecting all the computers represented by thegraph below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 33 / 37

Page 36: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesPrim’s Algorithm

Example: Use Prim’s algorithm to design a minimum-costcommunications network connecting all the computers represented by thegraph below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 34 / 37

Page 37: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesPrim’s Algorithm

Example: Use Prim’s algorithm to design a minimum-costcommunications network connecting all the computers represented by thegraph below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 34 / 37

Page 38: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesKruskal’s Algorithm

The difference between Prim’s and Kruskal’s algorithms is that in Prim’salgorithm edges of minimum weight that are incident to a vertex alreadyin the tree, and not forming a circuit, are chosen; whereas in Kruskal’salgorithm edges of minimum weight that are not necessarily incident to avertex already in the tree, and that do not form a circuit, are chosen.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 35 / 37

Page 39: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesKruskal’s Algorithm

Example: Use Kruskal’s algorithm to design a minimum-costcommunications network connecting all the computers represented by thegraph below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 36 / 37

Page 40: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Minimum Spanning TreesKruskal’s Algorithm

Example: Use Kruskal’s algorithm to design a minimum-costcommunications network connecting all the computers represented by thegraph below.

ECOM 2311- Discrete Mathematics - Ch.11 Dr. Musbah Shaat 36 / 37

Page 41: ECOM 2311- Discrete Mathematics10mmsite.iugaza.edu.ps/musbahshaat/files/chapter11_all_handout.pdf · ECOM 2311- Discrete Mathematics - Ch.11Dr. Musbah Shaat10/37. Introduction to

Homework- OPTIONAL [due 22nd of Dec].From the text book, Section 11.1, page 755Questions: Q2[Parts b,c,d,f], Q4, Q6 and Q10.From the text book, Section 11.2, page 769Questions: Q2, Q4[Parts a,d], Q6 ,Q20, Q22[Part a] and Q24.From the text book, Section 11.4, page 795Questions: Q14 and Q16 [Part related to Q14], and Q18[Part c].From the text book, Section 11.5, page 802Questions: Q2, Q4, Q6 and Q8.

End of Chapter # 11