Prezentare Animale

download Prezentare Animale

of 30

Transcript of Prezentare Animale

  • 8/17/2019 Prezentare Animale

    1/30

  • 8/17/2019 Prezentare Animale

    2/30

    Excursions in Modern Mathematics, 7e: 5.6 - 2Copyright © 200 !earson Education, "nc.

     5 The Mathematics of GettingAround

    5. Eu#er Circuit !ro$#ems

    5.2 %hat "s a &raph'

    5.( &raph Concepts and )ermino#ogy

    5.* &raph Mode#s

    5.5 Eu#er+s )heorems

    5.6 Fleury’s Algorithm

    5.7 Eu#eriing &raphs

  • 8/17/2019 Prezentare Animale

    3/30

    Excursions in Modern Mathematics, 7e: 5.6 - 3Copyright © 200 !earson Education, "nc.

    %hen the graph has an Eu#er  

    circuit orpath, ho do e ind it' /or sma## graphs,

    simp#e tria#-and-error usua##y ors ine, $ut

    rea#-#ie app#ications sometimes in1o#1e

    graphs ith hundreds, or  

    e1en thousands,

    o 1ertices. "n these cases a tria#-and-error

    approach is out o the uestion, and hat is

    needed is a systematic strategy that te##s usho to create an Eu#er circuit or path. "n

    other ords, e need an a#gorithm.

    Algorithms

  • 8/17/2019 Prezentare Animale

    4/30

    Excursions in Modern Mathematics, 7e: 5.6 - 4Copyright © 200 !earson Education, "nc.

    )here are many types o pro$#ems that can$e so#1ed $y simp#y o##oing a set o  procedura# ru#es31ery speciic ru#es #iewhen you get to this point, do this, ... after  

    you finish this, do that , and so on. &i1en aspeciic pro$#em X , an algorithm or  so#1ing

     X  is a set o procedural rules that, heno##oed, a#ays #ead to some sort o4so#ution to X .

     

     X  need not $e amathematics pro$#em3a#gorithms are used,sometimes unitting#y, in a## a#s o #ie:

    Algorithms

  • 8/17/2019 Prezentare Animale

    5/30

    Excursions in Modern Mathematics, 7e: 5.6 - 5Copyright © 200 !earson Education, "nc.

    directions to ind someone+s 

    house, theinstructions or assem$#ing a ne $ie, or arecipe or $aing an app#e pie are a##examp#es o rea#-#ie a#gorithms. useu#

    ana#ogy is to thin o the 

    pro$#em as a dishe ant to prepare and the a#gorithm as arecipe or preparing

     

    that dish. 

    "nmathematics, a#gorithms are either ormu#a

    dri1en you 8ust app#y the ormu#a orormu#as to the

     

    appropriate inputs9 ordirecti1e dri1en you must o##o a speciicset o directi1es9.

    Algorithms

  • 8/17/2019 Prezentare Animale

    6/30

    Excursions in Modern Mathematics, 7e: 5.6 - 6Copyright © 200 !earson Education, "nc.

    %e i## no turn our attention to ana#gorithm that inds an Euler circuit  or an Euler path in a connected graph.)echnica##y speaing, these are to

    separate a#gorithms, $ut in essence theyare identica#, so they can $e descri$ed asone.

    )he idea $ehind /#eury+s a#gorithm can $eparaphrased $y that o#d piece 

    o o#isdom: Don’t burn your bridges behindyou.

    Fleury’s Algorithm

  • 8/17/2019 Prezentare Animale

    7/30Excursions in Modern Mathematics, 7e: 5.6 - 7Copyright © 200 !earson Education, "nc.

    "n graph theory the 

    ord $ridge has a 1ery speciic 

    meaning3it is the on#y edge 

    connecting to

    separate sections 

    ca## them

    Fleury’s Algorithm

     A and B9

    o a

    graph, as

    i##ustrated

    in /ig.5-.

  • 8/17/2019 Prezentare Animale

    8/30Excursions in Modern Mathematics, 7e: 5.6 - 8Copyright © 200 !earson Education, "nc.

    )hus, /#eury+s a#gorithm is $ased on asimp#e princip#e: )o ind an Eu#er  circuit or

    an Eu#er path, bridges are the last edges

    you want to cross. ;ur concerns #ie on#y on

    ho e are going to get 

    around the yet-to-

    be-traveled  part o the graph. )hus, hen

    e ta# a$out $ridges that e ant to #ea1e

    as a #ast resort,e are rea##y reerring tobridges of the to-be-traveled part of the

    graph. 

    Fleury’s Algorithm

  • 8/17/2019 Prezentare Animale

    9/30Excursions in Modern Mathematics, 7e: 5.6 - 9Copyright © 200 !earson Education, "nc.

    < Preliminaries. Mae sure that the

    graph is connected and either 9 has

    no odd 1ertices circuit9 or 29 has 8ust

    to odd 1ertices path9.

    < Start. Choose a starting 1ertex. ="n

    case 9 this can $e any 1ertex> in

    case 

    29 it must $e one o the to odd1ertices.?

    /@EAB+D @&;B")M /;B

    /"FG"F& F EA@EB C"BCA") !)9

  • 8/17/2019 Prezentare Animale

    10/30Excursions in Modern Mathematics, 7e: 5.6 - 10Copyright © 200 !earson Education, "nc.

    < Intermediate steps. t each step, iyou ha1e a choice, don+t choose a

    $ridge o the yet-to-$e-tra1e#ed part 

    o the graph. oe1er, i you ha1eon#y one choice, tae it.

    < End. %hen you can+t tra1e# any

    more, the circuit path9 is comp#ete.="n case 9 you i## $e $ac at the

    starting 1ertex> in case 29 you i##

    end at the other odd 1ertex.?

    /@EAB+D @&;B")M /;B

    /"FG"F& F EA@EB C"BCA") !)9

  • 8/17/2019 Prezentare Animale

    11/30Excursions in Modern Mathematics, 7e: 5.6 - 11Copyright © 200 !earson Education, "nc.

    "n imp#ementing /#eury+s a#gorithm it is

    critica# to separate 

    the past 

    the part o the

    graph that has a#ready $een tra1e#ed9 rom

    the uture the part o the graph that sti##

    needs to $e tra1e#ed9. %hi#e there are manydierent ays to accomp#ish this you are

    certain#y encouraged to come up ith one

    o  

    your on9, a air#y re#ia$#e ay goes #iethis: Dtart ith to copies o the graph.

    Copy is to eep trac o the 4uture> copy

    2 is to eep trac o the 4past. 

    Fleury’s Algorithm Bookkeeping

  • 8/17/2019 Prezentare Animale

    12/30Excursions in Modern Mathematics, 7e: 5.6 - 12Copyright © 200 !earson Education, "nc.

    E1ery time you tra1e# a#ong an edge, erase

    the edge rom copy , $ut mar it say 

    in

    red9 and #a$e# it ith the appropriate

    num$er on copy 2. s you mo1e orard, 

    copy gets sma##er and copy 2 gets redder. t the end, copy has disappeared> copy 2

    shos the actua# Eu#er circuit or path.

    Fleury’s Algorithm Bookkeeping

  • 8/17/2019 Prezentare Animale

    13/30Excursions in Modern Mathematics, 7e: 5.6 - 13Copyright © 200 !earson Education, "nc.

    )he graph in /ig. 5-Ha9 is a 1ery simp#e

    graph 3 it ou#d $e easier to ind an Eu#er

    circuit 8ust $y tria#-and-error than $y using

    /#eury+s a#gorithm. Fonethe#ess, e i## do it

    using /#eury+s a#gorithm. )he rea# purpose o 

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

    the examp#e is to see the

    a#gorithm at or.Each stepo the a#gorithm is exp#ained

    in /igs. 5-H$9 through h9. 

  • 8/17/2019 Prezentare Animale

    14/30Excursions in Modern Mathematics, 7e: 5.6 - 14Copyright © 200 !earson Education, "nc.

    Start: %e can pic any starting point e

    ant. @et+s say e start at F .

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

  • 8/17/2019 Prezentare Animale

    15/30

    Excursions in Modern Mathematics, 7e: 5.6 - 15Copyright © 200 !earson Education, "nc.

    Step 1: )ra1e# rom F  to  . Cou#d ha1e a#so

    gone rom F  to D.9

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

  • 8/17/2019 Prezentare Animale

    16/30

    Excursions in Modern Mathematics, 7e: 5.6 - 16Copyright © 200 !earson Education, "nc.

    Step : )ra1e# rom   to D. Cou#d ha1e a#so

    gone to A or to E .9

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

  • 8/17/2019 Prezentare Animale

    17/30

    Excursions in Modern Mathematics, 7e: 5.6 - 17Copyright © 200 !earson Education, "nc.

    Step !: )ra1e# rom D to A. Cou#d ha1e a#so

    gone to B $ut not to F ! DF  is a $ridgeI9

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

  • 8/17/2019 Prezentare Animale

    18/30

    Excursions in Modern Mathematics, 7e: 5.6 - 18Copyright © 200 !earson Education, "nc.

    Step ": )ra1e# rom A to  . Cou#d ha1e a#so

    gone to E  $ut not to B 3 AB is a $ridgeI9

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

  • 8/17/2019 Prezentare Animale

    19/30

    Excursions in Modern Mathematics, 7e: 5.6 - 19Copyright © 200 !earson Education, "nc.

    Step 5: )ra1e# rom   to E . )here is no

    choiceI9

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

  • 8/17/2019 Prezentare Animale

    20/30

    Excursions in Modern Mathematics, 7e: 5.6 - 20Copyright © 200 !earson Education, "nc.

    Steps 6# $# %# and &: ;n#y one ay to goat each step.

    Examp#e 5.20 "mp#ementing /#eury+s

     #gorithm

  • 8/17/2019 Prezentare Animale

    21/30

  • 8/17/2019 Prezentare Animale

    22/30

    Excursions in Modern Mathematics, 7e: 5.6 - 22Copyright © 200 !earson Education, "nc.

    Dince it ou#d $e a #itt#e impractica# to sho

    each step o the a#gorithm ith a separate

    picture as e did in Examp#e 5.20, you are

    going to ha1e to do some o the or. Dtart$y maing to copies o the graph.

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    < Start. )his graph has to odd 1ertices, E  and " . %e can pic either one as the

     

    starting 1ertex. @et+s start at " .

  • 8/17/2019 Prezentare Animale

    23/30

    Excursions in Modern Mathematics, 7e: 5.6 - 23Copyright © 200 !earson Education, "nc.

    < Step 1. /rom "  e ha1e i1e choices, a## o

    hich are ;J. %e+## random#y pic # .

    Erase "#  on copy , and mar and #a$e#

    "#  ith a on copy 2.9

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    < Step 2. /rom #  e ha1e three choices B, $, or % 9. ny o these choices is

     

    ;J. Day

    e choose B. Fo erase #B rom copy

    and mar and #a$e# #B ith a 2 on copy 2.9 

  • 8/17/2019 Prezentare Animale

    24/30

    Excursions in Modern Mathematics, 7e: 5.6 - 24Copyright © 200 !earson Education, "nc.

    < Step 3. 

    /rom B e ha1e three choices  A,

     , or " 9. ny o these choices is ;J. Day

    e choose  . Fo erase B  rom copy

    and mar and #a$e# B  ith a 

    ( on copy 2.9

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    < Step 4. /rom   e ha1e three choices D, E , or $9. ny o these choices is

     

    ;J. Day

    e choose $. EM@3that+s shorthand or

    erase, mar, and #a$e#.9

  • 8/17/2019 Prezentare Animale

    25/30

    Excursions in Modern Mathematics, 7e: 5.6 - 25Copyright © 200 !earson Education, "nc.

    < Step 5. 

    /rom @ e ha1e three choices E , 

    &, or # 9. ny o these choices is ;J. Day

    e choose # . [email protected] 

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    < Step 6. /rom #  e ha1e on#y one choice3to . %e

     

    choose % . [email protected] 

  • 8/17/2019 Prezentare Animale

    26/30

    Excursions in Modern Mathematics, 7e: 5.6 - 26Copyright © 200 !earson Education, "nc.

    < Step 7. 

    /rom e ha1e three choices &,

    ' , or " 9. %e

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    shou#d not

    choose &, as

    %& is a $ridge

    o the yet-to-$e-

    tra1e#ed part othe graph see

    /ig. 5-29.

  • 8/17/2019 Prezentare Animale

    27/30

    Excursions in Modern Mathematics, 7e: 5.6 - 27Copyright © 200 !earson Education, "nc.

    < Step 7. 

    Either o the other to 

    choices is

    ;J. Day e

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    choose K.

    [email protected]

  • 8/17/2019 Prezentare Animale

    28/30

    Excursions in Modern Mathematics, 7e: 5.6 - 28Copyright © 200 !earson Education, "nc.

    < Step 8. 

    /rom "  e ha1e three choices  A,B, or ' 9, $ut e shou#d not choose ' , as "'  has 8ust $ecome a $ridge. Either o the

    other to choices is ;J. Day e 

    choose B.EM@9

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    < Step 9 through 13. Each time e ha1eon#y one choice.

     

    /rom B e ha1e to go to

     A, then to " , ' , % , and &.

  • 8/17/2019 Prezentare Animale

    29/30

    Excursions in Modern Mathematics, 7e: 5.6 - 29Copyright © 200 !earson Education, "nc.

    < Step 14 through 21. 

    Fot to $e#a$or thepoint, #et+s 8ust cut to the chase. )he rest othe path is gi1en $y &, F , E , D,  , E , &, $, 

    E . )here are many possi$#e endings, and you shou#d ind a dierent one $y yourse#.

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths

    )he comp#eted Eu#er path one o hundreds

    o possi$#e 

    ones9 is shon in /ig. 5-22.

  • 8/17/2019 Prezentare Animale

    30/30

    Examp#e 5.2 /#eury+s #gorithm or

    Eu#er !aths