You are on page 1of 33

Discrete Mathematics Modelling Our World

Graph Theory (Euler Paths and Circuits) In order to minimize cost to the city, how should weekly garbage collection routes bee designed for detroit's 350,000 households? Graph Theory (Travelling Salesman Pro lem) Sears, Roeback and com any inauages a flect of our !00 deli"ery "echicles to bring roducts they sell to costomers locations# $ow should sears determine an efficient deli"ery lan for each day# Matrices (Computer !epresentation o" Graphs) $ow can roblems like %etroit garbage collection or sear's deli"ery ser"ice be modelled in order to utilize technology for the solution# Matrices (Solving System o" E#uations) &roblems we sol"e nowadays ha"e thousands of e'uations, sometimes a million of "ariables# $ow do telecommunications com anies determine, how to route millions of long distance calls using e(isting resources of long distance land lines, re eater am lifier, and satellite terminals# Matrices (Geometric Trans"ormation) $a"e you e"er wondered how your fa"orite cartoon characters become animated? Counting $ %rranging $ow secure are your asswords? If your assword consists of 3 letters and 3 numbers, how likely is it that someone could successfully guess the configuration# Coding &n"ormation Identification numbers# )hat mathematics is in"ol"ed in the design of *&+ codes? Coding &n"ormation (Error'Detecting Codes) %id you know that many identification coeds contain check digits to hel catch errors#

Graph Theory &ntroduction ,ra hs are mathematical ob-ects that are made of dots connected by lines# ,ra h thoery is the branch of mathematics that in"ol"es the study of gra hs# ,ra h are "ery owerful tools for creating mathematical models of a wide "ariety of situations# ,ra hs thoery has been used as a tool for analyzing and sol"ing roblems in areas as di"erse as com uter network design, urban lanning and molecular biology# ,ra h theory has been used to find the best way to route and schedule air lanes and in"ent a secret code that no one can crack# (onigs erg )ridges Pro lem .onigsberg was a city in &russia situated on the &regel ri"er, which ser"ed as the residence of the dukes of &russia in the !/th century# 01oday, the city is named .aliningrad, and is a ma-or industrial and commercial center of western Russia2# 1he ri"er &regel floued through the town, creating an island, as in the following icture# Se"en bridges s anned the "arious branches of the ri"er, as shown#

3 famous roblem concerning .onigsberg was whether it was ossible to take a walk through the town in such a way as to cross o"er e"ery bridge once and only once and come to its starting oint# 1his roblem was first sol"ed by the rolific Swiss mathematician Leonard Euler, who in"ented the branch of mathematics now known as gra h theory in the rocess of his solution# 4uler's a roach was to regard the s ots of land 0there are 5 of them2 as oints to be "isited, and the bridges as aths between those oints# 1he mathematical essentials of the ma of .onigsberg can then be reduced to the following diagram, which is an e(am le of what is called a gra h#

3 gra h is a figure consisting of oints 0called "ertices 6 the lural of "erte(2 and connecting lines or cur"es 0called edges2# 1he roblem of the bridges of .onigsberg can then be reformulated as whether this gra h can be traced without tracing any edge more than once# 7or each of the "ertices of a gra h, the order of the "erte( is the number of edges at that "erte(# 1he figure below shows the gra h of the .onigsberg brdige roblem, with the orders of the "ertices labeled#

Euler*s Solution 4uler's solution to the roblem of the .onigsberg bridges in"lo"ed the obser"ations that when a "erte( is 8"isited9 in the middle of lthe rocess of tracing a gra h, there must be an edge coming into the "erte( and another edge lea"ing it, and so the order of the "erte( must be an e"en number# 1his must be true for all but at most two of the "ertices 6 the one you start at, and the one you end at, and so a connected gra h is tra"ersible iff it has at most two "ertices of odd order# 0:ote that the starting and ending "ertices may be same, in which case the order of e"ery "ertices must be e"en# :ow the gra h shown abo"e has more than two "ertices of odd order, and so the gra h can not be traced# 1hat is the desired walking tour of .onigsberg is im ossible#

Graph 3 graph is denoted by G = (V, E) where V consists of the set, V={v1, v2, ......., vn} called "ertices, and set 4={e1, e2, ......., en} whoes elements are called edges, such that each edge ek is identified with an unordered air 0vi, vj) of "ertices# 1he "ertices vi, vj associated withe edge ek are called the end "ertices of ek # Sel" +oop 3n edge ha"ing same "erte( as both its end "ertices is called a self loop or loop# Parallel Edges 4dges associated with a gi"en air of "ertices are known as parallel edges# Simple Graph 3 gra h that has neither self;loo s nor arallel edges is called a si!ple graph# Multigraph 3 !ul"igraph G = (V, E) consists of a set V of "ertieces, a set E of edges, and a function f from E to { u,v / u,v V,u v } such that for e ! , e < E im lies f e! =f e< # 0&arallel edges2 Pseudograph 3 pseudograph G = (V, E) consists of a set V of "ertices, a set E of edges and a function f from E to such that f e = {u,u }={ u } for some u V # Directed Graph 3 dire#"ed graph (V, E) consists of a set of "ertices V and a set of edges E that are ordered airs of elements of V# ,ndirected Graph

-inite Graphs $ &n"inite Graphs 3 gra h with a finite number of "ertices as well as finite number of edges is called a fini"e graph, otherwise, it is an infini"e graph# &ncidence and Degree )hen a "erte( v i is an end "erte( of some edge e j , v i and e j are said to be in#iden" with 0on or to2 each other# +onsider the following figure=

In this fig# edges e < , e / and e > are incident with "erte( v 5 # 1wo non; arallel edges are said to be adja#en" if they are incident on a common "erte(# 7or e(am le e < and e > in this fig# 3re ad-acent# Simillarly two "ertices are said to be adja#en" if they are the end "ertices of the same edge# In the fig# v 5 , v 5 3re ad-acent, but v ! , v 5 are not# 1he number of edges incident on a "erte( v i , with self;loo s counted twice, is called the degree, d v i of "erte( v i # In fig# d v ! =d v 3 =d v 5 =3, d v < =5, d v 5 =! # 1he degree of a "erte( is sometimes also referred to as its valen#$. Theorem ./ The 0andsha1ing Theorem ?et G = (V, E) be an undirected gra h with e edges, then < e= deg v #
v V

Proo"/ Since each edge contributes two degrees, the sum of the degrees of all "ertices in G is twice the number of edges in G# Theorem 2 1he number of "ertices of odd degree in a gra h is alway e"en# Proo"/ ?et v ! and v < be the set of "ertices of e"en degree and the set of "ertices of odd degree, res ecti"ely in an undirected gra h G = (V, E)# 1hen < e= deg v 0from the abo"e theorem2
v V

v V ! Even

deg v deg v
v V < %dd

Since deg v is e"en if v V ! 0sum of e"en no# Is e"en2

v V !

deg v =Even

deg v =<e Even=Even i#e# v V


<

3nd since all the terms in this sum are odd# 1herefore there must be an e"en number of such terms# $ence there are e"en number of "ertices of odd degree# &ncidence and degree "or directed graph )hen (u, v) is an eddge of the gra h G with directed edges, u is said to be adja#en" to v and u is said to be ad-acent from u. 1he "erte( u is called the initial "erte( of (u, v) and v is called the terminal or end "erte( of (u, v)# 1he initial "erte( and terminal "erte( of a loo are the same# In a gra h with directed edges the in;degree of a "erte( v, denoted by deg v , is the number of edges with v as their terminal "erte(# 1he out degree of v, denoted by deg v , is the number of edges with " as their initial "erte(# 0?oo at a "erte( contributes, to both the in;degree and the out;degree of this "erte(2# Theorem 3 ?et G = (V, E) be a gra h with directed edges, then
v V

deg v = deg v =E #
v V

!egular Graph 3 gra h in which all "ertices are of e'ual degree is called a regular graph 0or sim ly regular2# &solated 4erte5 3 "erte( ha"ing no incident edges i#e# "ertices ha"ing zero degree is called an isola"ed ver"e&# Pendent 4erte5 3 "erte( of degree one is called a penden" ver"e&# 6ull Graph 3 gra h without any edges, is called a null graph# Matri5 !epresentation o" Graphs So far we re resent a gra h by ictorial diagram, which are "ery con"enient for a "isual study A hel ful in understanding# But there are other re resentations which are better for com uter rocessing# 3 matri( is a con"enient and useful way of re resenting a gra h to a com uter# 1wo ty es of matrices are commonly used to re resent gra hs# Cne is based on the ad-acency of "ertices and the

other is based on incidence of "ertices and edges# %d7acency Matri5 Su ose that G = (V, E) is a sim le gra h where V =n # Su ose that the "ertices of G are listed arbitrarily as v ! , v < , # # ## # , v n # 1he ad-acency matri( ' of G, with res ect to this listing of the "ertices, is the n n zero;one matri( with ! as its (i, j)"h entry when v i and v j are ad-acent, and 0 as its (i, j)"h entry when they are not ad-acent# i#e# '= a ij n n with a ij= E5ample *se an ad-acency matri( to re resent the gra h shown in the following figure=

!, if {v i ,v j }isanedgeofG 0, %"her(ise

Solution/

E5ample %raw a gra h with following ad-acency matri( w#r#t the ordering of "ertices a, ), #, d=

0 ! ! 0

! 0 0 !

! 0 0 !

0 ! ! 0

Solution=

3d-acency matrices can also be used to re resent undirected gra hs with loo s and with multi le edges# 3 loo at the "erte( a i is re resented by a ! at the (i, i)"h osition of the ad-acency matri(# 7or multi le edges, (i, j)"h entry of the ad-acency matri( e'uals the number of edges that are associated to { ai ,a j } # E5ample *se an ad-acency matri( to re resent the seudogra h shown in fig# Below=

Solution/

&ncidence Matrices It is another way to re resent a gra h# ?et G = (V, E) be an undirected gra h# Su ose that v ! , V < , # ## ## , v n are the "ertices and e ! , e < , # ## # # , e ! are the edges of G# 1hen the incidence matri( w#r#t this ordering of V and E is the n ! matri( *= [ !ij ] , where ! ij= E5ample Re resent the gra h shown below with an incidence matri(

!, (henedgee j isin#iden"(i"hv i 0, %"her(ise

Solution/

Incidence matrices can also be used to re resent multi le edges and loo s# Dulti le edges are resented in the incidence matri( using columns with identical entries, since these edges are incident with the same air of "ertices# ?oo s are re resented using a column with e(actly one entry e'ual to !E corres onding to the "erte( that is incident with this loo s# E5ample Re resent the seudogra h shown below using an incidence matri(

Solution/

&somorphism 1he sim le gra hs G ! = V ! ,E 1 and G < = V < ,E 2 are isomor hic if there is one;to;one and onto function f from V ! to V < with the ro erty that a and ) are ad-acent in G! if and only if f a and f ) are ad-acent in G< , i#e# 1wo gra hs are said to be isomor hic to each other if there is one;one corres ondence between their "ertices and between their edges such that the incidence relationshi is reser"ed# 7or e(am le, the gra hs shown below are isomor hic to each other

1he corres ondence between the two gra hs is gi"en by the "ertices a, ), #, d and e corres ond to v ! , v < , v 3 , v 5 , v 5 # 1he edges !, <, 3, 5, 5 and / corress onds to e ! , e < , e3 , e 5 , e5 , e/ res ecti"ely# 1wo isomor hic gra hs must ha"e the following= 1he same number of "ertices# 1he same number of edges 3n e'ual number of "ertices with a gi"en degree#

But these conditions are not sufficient# 7or e(am le the gra hs shown below

Satisfy all the three conditions, yet they are not isomor hic# )hy? 7or the gra hs to be isomor hic, "erte( & must corres onds to $, since there are no "ertices other than these ha"ing degree 6 3# :ow in fig#;< there is only one endant "erte( ( ad-acent to $, but in fig#;! there are two endant "artices u and v ad-acent to (#

E5ample Show that the gra hs G=(V,E) and +(,, -) dis layed in fig# Below, are isomor hic#

Solution/ 1he function f with f u ! =v 1 , f u< =v . , f u 3 =v / , f u 5 =v 2 is a one;to;one corres ondence between V and ,# 1o see this corres ondence reser"es ad-acency, ad-acent "ertices in , are u! and u< , u! and u3 , u< and u 5 , u3 and u 5 and each of airs f u ! =v 1 and f u < =v . , f u ! =v 1 and f u 3 =v / , f u < =v . and f u 5 =v 2 , f u 3 =v / and f u 5 =v 2 are ad-acent in +# !emar1 It is "ery difficult to establish whether two sim le gra hs are isomor hic, as there are n0 ossible one;to;one corres ondences between the "erte( sets of two sim le gra hs with n "ertices# But, we can often show that two sim le gra hs are not isomor hic by showing that they do not share a ro erty that isomor hic sim le gra hs must both ha"e# Such a ro erty is called an in"ariant# &nvariant 1he isomor hic gra hs must ha"e same number of "ertices# 1he isomor hic gra hs must ha"e same number of edges# 1he degree of a "ertices in isomor hic sim le gra hs must be the same# i#e# 3 "erte( v of degree d in G must corres ond to a "erte( f(v) of degree d in +#

E5ample Show that the gra hs dis layed below are not isomor hic

Solution/ Both G and + ha"e 5 "ertices and / edges# $owe"er, + has a "erte( of degree !, namely e, where as G has no "ertices of degree !# it follows that G and + are not isomor hic# But these sets of ro erties are not sufficient# 1hat means, e"en when these in"ariants are the same, it does not necessarily mean that the two gra hs are isomor hic# E5ample %etermine whether the gra hs shown below are isomor hic

Solution/ 1he gra hs G and + both ha"e eight "ertices and !0 edges# 1hey both ha"e four "ertices of < and four "ertices degree 3# Since all these in"ariants agree, it is still concei"able that these gra hs are isomor hic# But G and + are not isomor hic# )hy? Since deg(a) = 2 in ,, a must corres ond to either ", u, & or $ in +, since these are "ertices of degree < in +. $owe"er, each of these four "ertices in + is ad-acent to another "erte( of degree < in +, which is not true for a in G# %d7acency 1o show f is an isomor hism, we can show that the ad-acency matri( of G is the same as the ad-acency matri( of +, when rows and columns are labeled to corres onds to the images under f of the "ertices in G that are the lables of these rows and columns in the ad-acency matri( of G#

E5ample %etermine whether the gra hs G and + dis layed below are isomor hic# Solution/

Solution/ Both G and + ha"e si( "ertices and se"en deges, d u! =<, d u< =3, d u3 =<, d u5 =3, d u5 =<, d u / =< E d v ! =<, d v < = <, d v 3 =3, d v 5 = <, d v 5 =3, d v / =< # 1herefore G ha"e four "ertices of degree < and < "ertices of degree 3# Similarly + ha"e four "ertices of degree < and < "ertices of degree 3# :ow first we will define a function f, and then determine whether it is isomor hism# d u! =< 3nd u is not ad-acent to any "erte( of degree ;<# 1herefore image of u! must be either v 5 or v / , the only "ertices of dgree < in + not ad-acent to "erte( of degree ;<# )e arbitrarily take f u ! =v 1 # 0If we found that this choice did not lead to isomor hism we would try f u ! =v 1 2# :ow u< is ad-acent to u! , the ossible images of u< are v 3 and v 5 # )e take f u < =v / # +ontinuing in this way, using ad-acency of "ertices A degree, we set f u 3 =v . , f u 5 =v 2 , f u 5 =v 1 ,f u/ =v 2 # 1hus the one;to;one corres ondence between "erte( set of G and +, we get f u ! =v 1 , f u< =v / , f u3 =v . , f u 5 =v 2 , f u5 =v 1 , f u/ =v 2 # 1o see f reser"es edges, we e(amine ad-acency matri( of G.

3nd the ad-acency matri( of +, with the rows and columns labeled by the images of the corres onding "ertices in G#

Since, 'G =' + E it follows that f reser"es edges# Su graph 3 gra h g is said to be a subgra h of a gra h G if all the "ertices and all the edges of g are also in G and each edge of g has the same end "ertices as in G#

7ig;< is one of the subgra h of 7ig;!# It can also be denoted as gG # 1he following are the ro erties of a subgra hs= 4"ery gra h is its own subgra h# 3 subra h of a subgra h of G is a subgra h of G# 3 single "erte( in a gra h G is a subgra h of G# 3 single edge in G, together with its end "ertices, is also a subgra h of G#

Edge'Dis7oint Su graphs 1wo subgra hs 0or more2 g! and g< of a gra h G are said to be edge dis-oint if g! and g< do not ha"e any edges in common, they may ha"e "ertices in common# 4erte5 Dis7oint Subgra hs that do not e"en ha"e "ertices in common are said to be "erte( dis-oint# % Pu88le 9ith Multicolored Cu es Pro lem )e are gi"en four cubes# 1he si( faces of e"ery cube are "ariously colored as blue, green, red or white# It is ossible to stack the cubes one on to of another to form a column such that no color a ears twice on any of the four sides of this column? 0+learly a trial;and;error method is unsatisfied, because we may ha"e to try all 5!,5>< 0@3 F <5 F <5 F <52 ossibilities2# Solution/ Ste ;!= %raw a gra h with four "ertices 3, G, 4, and , 6 one for each color, ick a cube and call it cube !, then re resents its three airs of o osite faces by three edges, drawn between the "ertices with a ro riate colors# If a blue face in cube ! has white face o osite to it, draw an edge between "ertices 3 and , in the gra h# %o the same for the remaining two airs of faces in cube !# &ut label ! on all three edges resulting from cube!# 3 self loo with the edge labeled ! at "erte( 4, for instance, would result if cube! had a air of o osite faces both colored red# Re eating the rocedure, we get a gra h with four "ertices and !< edges#

Ste <= +onsider the gra h resulting from this re resentation# 1he degree of each "erte( is the total number of faces with the corres onding color# 1herefore we ha"e fi"e blue faces, si( green, se"en red and si( white# +onsider two a osite "ertical sides of the desired column of four cubes, say facing north and south# 3 subgra h will re resent these eight faces 6 four facing south and four north# 4ach of the four edges in this subgra h will ha"e different label 6 !, <, 3 and 5# Doreo"er, no color occurs twice on either the north side or south side of the column iff e"ery "erte( in this subgra h is of degree two# 4(actly the same argument a lies to the other two sides, east and west of the column# 1hus the four cubes can be arranged 0to form a column such that no color a ears more than once on any side2 iff there e(ist two edge;dis-oint subgra hs, each with four edges, each of the edges labeled differently, and such that each "erte( is of degree two#

Wal1s 3 walk is defined as a finite alternating se'uence of "ertices and edges, beginning and ending with "ertices, such that each edge is incident with the "ertices recoding and following it# :o edge a ears 0is co"ered or tra"ersed2 more than once in a "erte(, howe"er, may a ear more than once# Terminal 4ertices Gertices with which a walk begins and ends are called its terminal "ertices# Closed Wal1 )alk whose terminal "ertices are same, is called closed walk# Open Wal1 )alk whose terminal "ertices are different, is called o en walk# Path 3n o en walk in which no "erte( a ears more than once is called a ath# 1he number of edges in a ath is called the length of a ath# 4dge which is not a self;loo is a ath of length one#

3 self;loo can be included in a walk but not in a ath# 1he terminal "ertices of a ath are of degree one, and the rest of the "ertices are of degree two#

Circuit 3 closed walk in which no "erte( 0e(ce t the initial and the final "erte(2 a ears more than once is called a circuit# 4"ery "erte( in a ciruit is of degree two# 3 circuit is also called a cycle, elementary cycle, circular ath and olygon#

Connected and Disconnected Graph 3 gra h G is said to be connected if there is at least one ath between e"ery air of "ertices in G, otherwise, G is disconnected# 3 null gra h of more than one "erte( is disconnected# Components 3 disconnected gra h consists of two or more connected gra hs# 4ach of these connected subgra hs is called a com onent# Theorem 3 gra h G is disconnected if and only if its "erte( set V can be artitioned into non em ty, dis-oint subsets V ! and V < such that there e(ists no edge in G whose one end "erte( is in subset V ! and the other in subset V < # Proo"/ Su ose such a artitioning e(ists# +onsider two arbitrary "ertices a and ) in G, such that a V ! and ) V < , no ath can e(ist between a and ), otherwise there would be at least one edge whose one end "erte( would be in V ! and other in V < # $ence, if a artition e(ists, G is not connected# +on"ersly, let G be a disconnected gra h, consider a "erte( a in G# ?et V ! be the set of all "ertices that are -oined by aths to a. Since G is disconnected V ! does not include all "ertices of G# 1he

remaining "ertices will for a 0non em ty2 set V < # :o "erte( in V ! is -oined to any in V < by an edge# $ence the artion# Theorem If a gra h 0connected or disconnected2 has e(actly two "ertices of odd degree, there must a a ath -oining these two "ertices# Proo"/ ?et G be a gra h with all e"en "erte(, e(ce t "ertices v ! and v < , which are odd# :ow, since we know that no gra h can ha"e an odd number of odd "ertices# 1herefore, v ! and v < must belong to the same com onent if G disconnected and hence there must be a ath between v ! and v < # Cut 4erte5 and Cut Edge Remo"al of a "erte( and all edges incident with it roduces a subgra h with more connected com onents than inthe original gra h# Such "ertices are called cut "ertices# 3n edge whose remo"al roduces a gra h with more connected com onents than in the original gra h is called a cut edge or bridge# E5ample 7ind the cut "ertices and cut edges in the gra h G#

Solution/ 1he cut "ertices= ), #, e 1he cut edge= {a, )} and {#, e} Remo"ing either one of these edges disconnects G# Strongly Connected 3 directed gra h is strongly connected if there is a ath from a to ) and from ) to a whene"er a and ) are "ertices in the gra h#

Wea1ly Connected 3 directed gra h is weakly connected if there is a ath between any two "ertices in the underlying undirected gra h# Euler Circuit 3 4uler circuit in a gra h G is a closed walk containing e"ery edge of G# Euler Path 3n 4uler ath in G is an o en walk containing e"ery edge of G# E5ample )hich of the undirected gra hs in figure ha"e an 4uler circuit? Cf those that do not, which ha"e an 4uler ath?

Solution/ 1he gra hs G1 has an 4uler circuit, for e(am le, a, e, #, d, e, ), a. :either of the gra hs G2 or G/ has an 4uler circuit# $owe"er, G/ has an 4uler ath, namely, a, #, d, e, ) d, a, )# Euler Graphs In a gra h, if there e(ist some closed walk which contains all the edges of the gra h called an 4uler line, then the gra h is known as 4ulear gra h# Theorem 3 gi"en connected gra h G has an 4uler circuit if and only if all "ertices of G are of e"en degree# Proo"/ Su ose G has an 4uler circuit# 1his im lies G contains a closed walk# In tracing this walk, we obser"e that e"ery time the walk meets a "erte( v it goes through two 8new9 edges incident on v 6 with one we entered v and with the other e(ited#

1his is true for not only all the intermediate "ertices, of the walk, but also the terminal "erte(, because we 8e(ited9 and 8entered9 the same "erte( at the beginning and and end of the walk# 1hus if G has an 4uler circuit, the degree of e"ery "erte( is e"en# +on"ersely, assume all the "ertices of G are of e"en degree# :ow we construct a walk starting at an arbitrary "erte( v and going through the edges of G such that no edge is traced more than once# )e continue tracing as far as ossible# Since e"ery "erte( is of e"en degree, we can e(it from e"ery "erte( we enter, and tracing cannot sto at any "erte( but v# Since v is also of e"en degree, we shall e"entually reach v when the tracing comes to an end# If this closed walk h, we -ust traced includes all the edges of G, G has an 4uler circuit# If not, we remo"e from G all the edges in h and obtain a subgra h h5 of G formed by remaining edges# Since both G and h ha"e all their "ertices of e"en degree, the degrees of "ertices of h5 are also e"en# Doreo"er, h5 must touch h at least at one "erte( a, because G is connected# Starting from a, we can again construct a new walk in gra h h5# Since all the "ertices of h5 are of e"en degree, this walk in h5 must terminate at "erte( a# But this walk in h5 can be combined with h to form a new walk, which starts and ends at "erte( v and has more edges than h# 1his rocess can be re eated untill we obtain a closed walk that tra"erse all the edges of G# 1hus G is an 4uler gra h# ,nicursal Graph 3n o en walk that includes all edges of a gra h without retracing any edge is called a unicursal line or an o en 4uler line# 3 0connected2 gra h that has a unicursal line will be called a unicursal gra h# By adding an edge between the initial and final "ertices of a unicursal line, we shall get an 4uler line# 1hus a connected gra h is unicursal if and only if it has e(actly two "ertices of odd degree# Theorem In a connnected gra h G with e(actly 2k odd "ertices, there e(ist k edge;dis-oint subgra hs such that they together contain all edges of G and that each is unicursal gra h# Theorem 3 connected multigra h has an 4uler ath but not an 4uler circuit if and only if it has e(actly two "ertices of odd degree# Proo"/ 7irst, su ose that a connected multigra h does ha"e an 4uler ath from a to ), but not an 4uler circuit# 1he first edge of the ath contributes ! to the degree of a# 3 contribution of < to the degree of a is made e"ery time the ath asses through a# 1he last edge in the ath contributes ! to the degree of )# 4"ery time the ath goes through ) there is a contribution of < to its degree# +onse'uently both a and ) ha"e odd degree# 4"ery other "erte( has e"en deree, since the ath contributes < to the degree of a "erte( whene"er it asses through it# +on"ersely, su ose a gra h has e(actly two "ertices of odd degree, say a and )# +onsider the

larger gra h made u of the original gra h with the addition of an edge {a, )}# 4"ery "erte( of this larger gra h has e"en degree, so that there is an 4uler circuit# 1he remo"al of the new edge roduces an 4uler ath in the original gra h# Property/ 3 connected gra h G is an 4uler gra h if and only if it can be decom osed into circuits# %r itrarily Trace le Graphs In an 4uler gra h, if an 4uler line is always obtained when one follows any walk from a "erte( v according to the single rule that whene"er one arri"es at a "erte( one shall select any edge, which has not been re"iously tra"ersed# Such a gra h is called an arbitrarily tracea ble gra h from v# 7or e(am le in the following figure the 4uler gra h is an arbitrarily traceable gra h from "erte( #, but not from any other "erte(#

Property/ 3n 4uler gra h G is arbitrarily traceable from "erte( v in G if and only if e"ery ciruit in G contain v# 0amiltonian Paths and Circuits 3 circuit is a connected gra h G is said to be $amiltonian if it includes e"ery "erte( of G# $ence a $amiltonian circuit in a gra h of n "ertices consists of e(actly n edges# If we remo"e any one edge from $amiltonian circuit, we are left with a ath# 1his ath is called a $amiltonian ath# Complete Graph 3 sim le gra h in which there e(ists an edge between e"ery air of "ertices is called a com lete gra h#

3 com lete gra h is sometimes also referred to as a uni"ersal gra h or a cli'ue# Since e"ery "erte( is -oined with e"ery other "erte( through one edge, the degree of e"ery "erte( is n 1 in a com lete gra h G of n "ertices#

Trees/ 3 connected gra h that contain no sim le circuits is called a tree# 4nglish Dathematician 3rthur +aley used trees to count certain ty es of chemical com ounds as long ago as !H5># 1rees are articularly useful in com uter science= 1rees are em loyed to construct efficient algorithms for locating items in a list# 1rees are used to construct networks with the least e( ensi"e set of tele hone lines# 1rees can be used to construct efficient codes for storing and transmitting data# 1rees can model rocedures that are carried out using a se'uence of decesions# Theorem/ 3n undirected gra h is a tree if and only if there is a uni'ue sim le ath between any two of its "ertices# Proo"/ 7irst assume that 1 is a tree# 1his im lies 1 is a connected gra h no sim le circuits# ?et & and $ be two "ertices o f 1# Since 1 is connected there is a sim le ath between & and $, also the ath must be uni'ue# If there were a second such ath, the ath formed by combining the first ath 0from & to $ followed by ath from $ to &2 would form a circuit# )hich is not ossible in a tree, hence there is a uni'ue sim le ath between any two "ertices in a tree# +on"ersly, 3ssume that there is a uni'ue sim le ath between any two "ertices of the gra h 1, so 1 is connected, since there is a ath between any two of any two its "ertices# 3lso 1 can ha"e no sim le circuit 0 roof= su ose 1 has a sim le circuit that contains the "ertices & and $, then would be two sim le aths between & and $, one from & to $ and other from $ to &, that is contradicting our assum tion#2 $ence the gra h with a uni'ue sim le ath between any two "ertices is a tree# !oot/ In trees a articular "erte( is designated as root, from which all the branches of tree are generated# !ooted Tree/ 3 tree with a root is called rooted tree# Parent and Child/ If " a "erte( in a tree 1 other than a root, the arent of " is the uni'ue "erte( u such that their is a directed edge from u to " and " is called a child of u# Gertices with a same arent are called silings# 1he ancestors of a "erte( other than the root are the "ertices in ath from the root to this "erte( e(cluding the "erte( itself and including the root# 1he descendants of a "erte( " are those "ertices that ha"e " as an ancestor# 3 "erte( fo a tree is called a leaf it it has no children# Gertices that ha"e children are called internal "ertices#e( in a tree#

Su tree/ If 'a' is a "erte( in a tree, the subtree with 'a' as its root is the subgra h of the tree consisting of 'a' and its descendants and all edges incident to these descendants# m;ary tree= 3 rooted tree is called an m;ary tree if e"ery internal "erte( has no more than m children# % "ull m'ary tree/ 1he tree is called a full m;ary tree if e"ery internal "erte( has e(actly m children# 3 m;ary tree with m@< is called a binary tree# Properties/ 3 full m;ary tree with i internal "ertices contains n@miI! "ertices# 3 full m;ary tree with n "ertices has i@0n;!2Jm internal "ertices and l@K0m;!2nI!LJm lea"es# 3 full m;ary tree with i internal "ertices has n@miI! "ertices and l@0m;!2iI! lea"es# 3 full m;ary tree with l lea"es ha n@0ml;!2J0m;!2 "ertices and i@0l;!2J0m;!2 internal#

Ordered rooted tree/ 3n ordered rooted tree where the children of each internal "ertices are ordered# Crdered rooted tree are drawn so that the children of each internal "erte( are shown in order from left to right# In an ordered inary tree, if an internal "erte( has two children, the first child is the left child, and the second child is called the right child# 1he tree rooted at the left child of a "erte( is called left child# Subtree of this "erte( and the tree rooted at the right child of a "erte( is called the right subtree# +evel/ 1he le"el of "erte( " in a rooted tree is the length of the uni'ue ath from the root to this "erte(# 1he le"el of the root is defined to be zero# 0eight/ 1he height of a rooted tree is the ma(imum of the le"els of "ertices# In other words, the height of a rooted treee is the length of the longest ath from the root to any "erte(# )alanced/ 3 rooted m;ary tree of height h is balanced if all lea"es are at le"els h or h;!# Distance and centers in a tree/ 3 "erte( with minimum eccentricity in gra h , is called a center of ,# Properties o" trees/ Theorem ./ 3 tree with n "ertices has 0n;!2 edges#

Proo"/ 1his theorem is ro"ed y induction on the number of "ertices# 7or, n@!, i#e# :o edges, i#e# edges@0@!;!@n;!# 7or, n@<, i#e# Cne edge, i#e# edges@!@<;!@n;!# 7or, n@3, i#e# no# Cf edges@<@3;!@n;!# 1herefore theorem is true for n@!, <, 3# of ?et us assume that the theorem is true for all trees with less than n "ertices# ?et us now consider a tree 1 with n;"ertices# In 1 let e k be an edge with end "ertices "i and "- # Since, we know that, there is no other ath between "i and "- e(ce t ek# 1herefore deletion ek from 1 will disconect the gra h# 1herefore, 1;ek consists of e(actly two com onents, and since there were no circuits in 1 to begin with, each of these com onents in a tree# 3nd both these trees, t! and t< ha"e less than n "ertices each, and therefore, y the induction hy othesis, each contains one less edge than the numer of "ertices in it# 1hus 1;ek consists of n;< edges 0and n "ertices2 $ence 1 has e(actly n;! edges# Theorem 2/ 3ny connected gra h with n "ertices and n;! edges is a tree# )ithout &roof# Dinimally +onnected= 3 connected gra h is said to be minimally connected if remo"al of any one edge from it disconnets the gra h# Theorem 3/ 3 gra h is a tree if it is minimally connected# )ithout &roof# 3 lication= 1o inter;connect n distinct oints the minimum number of line segment needed is n;!# :ow in electrically engineering, to inter;connect n ins together, one needs at least n;! ieces of wires#

Theorem :/ 3 gra h , with n "ertices, n;! edges and no circuit is connected and hence tree# )ithout &roof# The "ollo9ing statements are e#uivalent/ , is connected and is circuitless# , is connected and has n;! edges# , is circuitless and has n;! edges# 1here is e(actly one ath between e"ery air of "ertice in ,# , is a minimally connected ,ra h#

Traversal %lgorithms &rocedure for systematically "isiting e"ery "erte( of an ordered rooted tree are called tra"ersal algorithms# It can be clasified as re;order, in;order and ost;order tra"ersal# Pre'order Traversal ?et 1 be an ordered rooted tree with root r# If 1 consist only of r, then r is re;order tra"ersal of 1# Ctherwise su ose that 1!, 1<######1n are subtrees at r from left to right in 1# &re;order tra"ersal begins by "isiting r it continues by tra"ersing 1! in re;order, then 1< in re;order and so on, untill 1n is tra"ersed in re;order# E5ample In which order does a reorder tra"ersal "isit the "ertices in the ordered rooted tree 6 shown in the following figure=

Solution )e tra"erse 6 in reorder by first listing the root a, followed by the reorder list of the subtree with root ), the reorder list of the subtree with root #0 which is -ust #2 and the reorder list of the subtree with root d# 1he reoreder list of the subtree with root ) begins by listing ), then the "ertices of the subtree with root e in reorder, and then the subtree with root f in reorder 0which is -ust f2# the reorder list of the subtree with root d begins by listing d, followed by the reorder list of the subtree with root g, followed by the subtree with root h 0which is -ust h2, followed by the subtree with root i 0which is -ust i2#

1he reorder list of the subtree wwith root e begins by listing e, followed by the reorder listing of the subtree with root j 0which is -ust j2, followed by the reorder listing of the subtree with root k# 1he reorder listing of the subtree with root g is g follwed by l, followed by !# 1he reorder lisitng of the subtree with root k is k, n, o, p# +onse'uently, the reorder tra"ersal of 6 is a, ), e, j, k, n, o, p, f, #, d, g, l, !, h, i# &n'order Traversal ?et 1 be an ordered rooted tree with root r# If 1 consist only of r, then r is in;order tra"ersal of 1# Ctherwise su ose that 1!, 1<######1n are subtrees at r from left to right in 1# In;order tra"ersal begins by tra"ersing 1! in in;order, then "isit r it continues by tra"ersing 1< in in;order then 13 in in;order########and finally 1n in in;order# E5ample In which order does an inorder tra"ersal "isit the "ertices of the ordered rooted tree 6 in the following figure=

Solution 1he inorder tra"ersal begins with an inorder tra"ersal of the subtree with root ), the root a, the inorder listing of the subtree with root #, whiich is -ust #, and the inorder listing of the subtree with root d# 1he inorder listing of the subtree with root ) begins with the inorder listing of the subtree with root e, the root ), and f# 1he inorder listing of the subtree with root d begins with the inorder listing of the subtree with root g, followed by the root d, followed by h, followed by i# 1he inorder listing of the subtree with root e is j, followed by the root e, followed by the inorder listing of the subtree with root k# 1he inorder listing of the subtree with root g is l, g, !# 1he inorder listing of the subtree with root k is n, k, o, p# +onse'uently, the inorder listing of the ordered rooted tree is j, e, n, k, o, p, ), f, a, #, l, g, !, d, h, i# Post'order Traversal ?et 1 be an ordered rooted tree with root r# If 1 consist only of r, then r is ost;order tra"ersal of 1# Ctherwise su ose that 1!, 1<######1n are subtrees at r from left to right in 1# &ost;order tra"ersal begins by tra"ersing 1! in ost order, then 1< in ost order, ######## 1n in ost order and ends by "isiting r#

E5ample In which order does a ost order tra"ersal "isit the "ertices of the ordered rooted tree 6 in the following figure

Solution 1he ost order tra"ersal begins with the ostorder tra"ersal of the subtree with root ), the ostorder tra"ersal of the subtree with root #, which is -ust #, the ostorder tra"ersal of the subtree with root d, followed by the root a# 1he ostorder tra"ersal of the subtree with root ) begins with the ostorder tra"ersal of the subtree with root e, followed by f, followed by the root )# 1he ost order tra"ersal of the rooted tree with root d begins with the ostorder tra"ersal of the subtree with root g, followed by h, followed by i, followed by the root d# 1he ostorder tra"ersal of the subtree with root e begins with j, followed by the ostorder tra"ersal of the subtree with root k, followed by the root e# 1he ostorder tra"ersal of the subtree with root g is l, !, g# 1he ostorder tra"ersal of the subtree with root k is n, o, p, k# 1herefore, the ostorder tra"ersal of 6 is j, n, o, p, k, e, f, ), #, l, !, g, h, i, d, a# E5ample/ )hat is the ordered rooted tree that re resents the e( ression &7$ < & 5 / 3 8 &n"i5; Pre"i5 and Post"i5 6otation 3 fully arenthesized e( ression obtained is said to be in in"i5 "orm< )e obtain the pre"i5 "orm of an e( ression when we tra"erse its root tree in re;order# 4( ressions written in refi( form are said to be in Polish notation< )e obtain the post"i5 "orm of an e( ression by tra"ersing its binary tree in ost order# 4( ressions written in ostfi( form are said to e in reverse polish notation< E5ample/ )hat is the refi( form for &7$ < & 5 / 3 8 E5ample/ )hat is the ost fi( form of the e( ression &7$ < & 5 / 3 8 E5ample/ )hat is the "alue of the refi( e( ression I ; M < 3 5 J < 3 5?

E5ample/ )hat is the "alue of the ostfi( e( ression > < 3 M ; 5 N 3 J I? Spanning Tree/ ?et , be a sim le gra h, a s anning tree of , is a subgra h of , that is a tree containing e"ery "erte( of ,# 6ote/ S anning tree is not uni'ue# S anning trees are im ortant in data netwroking# Theorem/ 3 sim le gra h is connected if and only if it has a s anning tree# %lgorithms "or "inding spanning trees/ .< Depth'-irst Search/ 3rbitrarily choose a "erte( of a gra h as a root# 7orm a ath starting at this "erte( by successi"ely adding "ertices and edges, where each new edge is incident with the last "erte( in the ath and a "erte( not already in the ath# +ontinue adding "ertices and edges in this ath as long as ossible, if the ath goes through all the "ertices of the gra h, the tree consisting of this ath is a s anning tree# $owe"er, if the ath does not goes through all "ertices, more "ertices and edges must be added# Do"e back to the ne(t to last "erte( in the ath and if ossible form a new ath starting at this "erte( assing through the "ertieces that were not already "isited# If this can not be done, mo"e back another "erte( in the ath# Re eat this rocedure, beginning at the last "erte( "isited, mo"ing back u the ath one "erte( at the time, forming a new ath that are as long as ossible untill no more edges can be added# E5ample/ *se a de th;first search to find a s anning tree for the gra h G shown in the following figure

Solution )e arbitrarily start with the "erte( f# 3 ath is built by successi"ely adding edges incident with "ertices not already in the ath, as long as this is ossible# 1his roduces a ath f, g, h, k, j# :e(t, backtrack to k# 1here is no ath beginning at k containing "ertices not already "isited# So we backtrack to h# 7orm the ath h, i# 1hen backtrack to h, and then to f# 7rom f build the ath f, d, e, #, a# 1hen backtract to # and form the ath #, )# 1his roduces the s anning tree#

2< )readth'-irst Search/ 3rbitrarily choose a "erte( of a gra h as a root# 3dd all edges incident to this "erte(# 1he new "ertices added at this stage become the "ertices at le"el ! in the s anning tree# :e(t, for each "erte( at le"el ! each each edge incident to this "erte( to the tree as long as it does not roduce a sim le circuit# 1his roduces the "ertices at le"el < in the tree, follow the same rocedure untill all the "ertices in the tree ha"e been added# 1he rocedure ends since there are only finite number of edges in the gra h# 3 s anning tree is thus roduced since we ha"e roduced a tree containing e"ery "erte( of the gra h# E5ample *se breadth;first search to find a s anning tree for the gra h shown below

Solution )e choose the "erte( e to be the root# 1hen we add edges incident with all "ertices ad-acent to e, so that edges from e to ), d, f, and i are added# 1hese four "ertices are at le"el ! in the tree# :e(t, add the edges from these "ertices at le"el ! to ad-acent "ertices not already in the tree# $ence, the edges from ) to a and # are added, as are edges from d to h, from f to j and g, and from i to k# 1he new "ertices a, #, h, j, g, and k are at le"el <# :e(t, add edges from these "ertices to ad-acent "ertices not already in the gra h# 1his adds edges from g to l and from k to !#

Minimum spanning tree/ 3 minimum s anning tree is in a connected weighted gra h is a s anning tree that has the smallest ossible sum of weights of its edges# %lgorithms "or Minimum spanning tree/ .< Prime*s %lgorithm 1his algorithm was gi"en by Robert &rime in !N5># +hoose any edge with smallest weight and successi"ely add edge of ne(t minimum weight that are incident to the "erte( already in the tree and not forming a sim le circuit# Sto this rocedure when n;! edges ha"e been added# E5ample/ *se &rim's algorithm to find a minimum s anning tree in the gra h shown below

Solution +hoice ! < 3 5 5 / > H N !0 !! 4dge Ob, fP Oa, bP Of, -P Oa, eP Oi, -P Of, gP Oc, gP Oc, dP Og, hP Oh, lP Ok, lP )eight ! < < 3 3 3 < ! 3 3 ! 1otal <5

2< (rus1al*s %lgorithm/ 1his algorithm was disco"ered by Qose h .ruskal in !N5/# +hoose an edge in the gra h with minimum weight and succesi"ely add edges with minimum weight that do not form a sim le cirucit with those edges already choosen, sto after n;! edges ha"e been selected# E5ample/ *se .ruskal's algorithm to find a minimum s anning tree in the weighted gra h shown in the following figure

Solution +hoice ! < 3 5 5 / > H N !0 !! 4dge Oc, dP Ok, lP Ob, fP Oc, gP Oa, bP Of, -P Ob, cP O-, kP Og, hP Oi, -P Oa, eP )eight ! ! ! < < < 3 3 3 3 3 1otal <5

Di""erence et9een Prim*s and (rus1al*s %lgorithm/ In rime's algorithm edges of minimum weight that incident to a "erte( already in the tree and not forming a circuit are chosen# )here as in .ruskal's algorithm edges of minimum weight that are not necessarily incident to a "erte( already in the tree and that do not form a circuit are chosen# In rime's algorithm if the edges are not ordered, there may be more than one choices of edges to add at the stage of this rocedure, conce'uently the edges need to be ordered for the rocedure to be deterministic#

You might also like