Se Travelling

download Se Travelling

of 7

Transcript of Se Travelling

  • 8/11/2019 Se Travelling

    1/7

    Notes on Graph TheoryTravelling Problems

    Review of definitions and basic theorems:

    1. A walkin a graph Gis a finite sequence of edges 1 2( , , , )ne e eK in which any two

    consecutive edges are adjacent of identical.

    2. A walk in which all edges are distinct is called a trail.

    3. f the vertices of a trail are distinct (e!cept the initial verte! and final verte! possi"lycoincide), then the trail is called apath.

    #. $e say a walk%trail%path is closedif the initial verte! is also the finial verte!.

    &. A closed path with at least one edge is called a cycle.

    '. A graph is connectedif and only if there is a path "etween each pair of vertices.

    . f Gis a siple graph with nvertices, medges, and kcoponents, then

    1

    2

    n kn k m

    +

    .

    As a corollary, any siple graph with nvertices and ore than1

    2

    n

    edges

    ust "e connected.

    Eulerian graphs

    A connected graph G is said to "eEulerianif there e!ists a closed trail containing every edgeof G. A non*+ulerian graph G is said to "esemi-Eulerianif there e!ists a trail containing

    every edge of G .

    he nae -+ulerian arises fro the fact that +uler was the first person to solve the

    faous /0nigs"erg "ridges pro"le. he pro"le asks whether you can cross each ofthe following seven "ridges e!actly once and return to your starting point.

    age 1 of

  • 8/11/2019 Se Travelling

    2/7

  • 8/11/2019 Se Travelling

    3/7

    Theorem (. !)leury*s algorithm&

    :et G"e an +ulerian graph. hen the following construction is always possi"le, andproduces an +ulerian trail of G.

    5tart at any verte! uand traverse the edges ar"itrarily, e!cept su"ject to 2 rules;

    (a) erase the edges as they are traversed, and the isolated vertices resulted (if any) , there are n3 ordered pairs 1( , )i iv v + where 2, , 2i n= K . :etA"e the set ofthe pairs such that 1 1, iv v + are adjacent andB"e the set of those such that ,i nv v are adjacent.

    5ince 1deg( ) deg( )nv v n+ , we have 2A B n+ . 6ut there is only n 3 pairs, one of the

    pair, says 1( , )j jv v + with 2 2j n , ust "elong to "othAandB. herefore, 1v is adjacent

    to 1jv + and jv is adjacent to nv , as shown in the following figure.

    8ow, 1 2 1 1 1j n n jv v v v v v v + L L is a =ailtonian cycle.

    n "oth cases, we lead to a contradiction "y constructing a =ailtonian cycle. $e concludethat Gis =ailtonian.

    'orollary. !/irac" -0(&

    f Gis a siple graph with 3n vertices such that deg( )2

    nv for each verte! v, then Gis

    =ailtonian.

    age # of

    v1 v2

    vj

    vj+1 vn-1

    vn

  • 8/11/2019 Se Travelling

    5/7

    The shortest path problem

    A connected graph in which a non*negative real nu"eris assigned to each edge is called

    weighted graph, the nu"er assigned to the edge eis the weightof e, denoted "y ( )w e .

    Problem.

    9ind a path "etween two vertices in a weighted (siple) graph with iniu total weight.

    here is an efficient algorith to solve this kind of pro"les. $e will go through this "y ane!aple;

    o find the shortest path froAtoB, we use the following ethod;

    !& 1ssign to each verte2 ad3acent to A" it*s distance from A.

    2

    5

    1

    A B

    !(& 1mong this numbers" mar4 the smallest number !if it is not uni5ue" 3ust chooseone of them& by any symbol !here we will use a 678&. 9n this algorithm" a mar4ednumber means it is the shortest distance from Ato that verte2.

    2

    5

    1*

    A B

    Then" repeat the following ( steps:

    !a& Let , ( )u d u be the verte2 and number mar4ed in the previous step. )or each

    unmar4ed verte2 v A ad3acent to u" calculate the sum ( ) ( )d u w uv+ . 9f this sumis less than the value at v" or we have not assigned any value to v" then the value atvis updated by this sum.

    1ny unmar4ed number in this stage means the shortest distance from

    Ato thatverte2 passing through only mar4ed verte2.

    age & of

    2

    3

    4

    1 5

    3

    6

    1

    7

    1

    5 4

    1

    A B

  • 8/11/2019 Se Travelling

    6/7

    !b& 1mong all unmar4ed numbers" mar4 the smallest one !again" if it is not uni5uethen choose any one of them&.

    n our e!aple, repeat (a) and (") we will get;

    2*

    5

    1*

    A B

    8

    2* 5

    5*

    1*

    A B

    8

    2* 5*

    5*

    1*

    A

    11

    B

    6

    9

    2* 5*

    5*

    1*

    A

    8

    B

    6*

    9

    2* 5*

    5*

    1*

    A

    8

    B

    6*

    7*

    he shortest distance froAtoBis and the shortest path can "e found "y tracing "ack thesteps.

    age ' of

  • 8/11/2019 Se Travelling

    7/7

    The 'hinese postman problem

    his pro"le is discussed "y 4hinese atheatican >ei*/u /wan, asking the ostefficient walk (with least repeat) for a postan to traverse each road in his route.

    Problem.

    n a weighted (siple) graph, find a closed walk to traverse each edge at least once withiniu total weight.

    8ote that if the graph is +ulerian, then the required walk is siply the +ulerian trail.

    An o"vious inequality a"out the iniu total weight dis

    ( ) 2 ( )w e d w e ,"ecause dou"le each edge will give an +ulerian graph.

    f the graph is sei*+ulerian, we can ake it "ecoe +ulerian "y dou"le each edge in theshortest path joining two odd vertices. he +ulerian trail will "e our required (ost efficient)walk.

    n general, the ost efficient walk can "e o"tained "y dou"le soe path(s), each path "eingthe shortest path joining two odd vertices (reind that the nu"er of odd vertices inany graph ust "e even, "y hand*shaking lea). he resulting graph is +ulerianand the required walk is then the +ulerian trail.

    f the graph has 2k(where 1k ) odd vertices then there are (2k1) possi"le ways to pairup the odd vertices. $e need to try all these possi"le ways

    The travelling salesman problem

    Problem.

    n a weighted (siple) graph, find a =ailtonian cycle of least total weight. 6y adding e!traedges with infinite weight if necessary, we ay assue the graph is coplete.

    7

    4

    3 4

    5

    3

    2

    6

    3

    5

    C D

    B

    A

    E

    ?p to now, no efficient algoriths are known. 5oe -quick algoriths can only find an

    appro!iated solution.

    age of