Graphes et algorithmique des graphes - Serveur de perso.ens-lyon.fr/eric.thierry/Graphes2009/  ·...

download Graphes et algorithmique des graphes - Serveur de perso.ens-lyon.fr/eric.thierry/Graphes2009/  · Graphes

of 71

  • date post

    10-Sep-2018
  • Category

    Documents

  • view

    216
  • download

    2

Embed Size (px)

Transcript of Graphes et algorithmique des graphes - Serveur de perso.ens-lyon.fr/eric.thierry/Graphes2009/  ·...

  • Graphes et algorithmique des graphes

    cours: Vincent Bouchitteredaction: Brice Goglin

    relecture: Jean-Baptiste Rouquier.

    Ecole normale superieure de Lyon3e annee de licence dinformatique

  • 2

    Version provisoire non relue par lenseignant.

    Ce document est distribue sous la license page suivante.En resume, vous pouvez distribuer ce document autant que souhaite, a condi-

    tion ne pas le modifer (vous etes invites a signalez les erreurs) ou dindiquerclairement les modifications, de laisser intact la license, et de ne rien demanderen echange, excepte deventuels frais de reproduction. Une diffusion par internetdoit etre gratuite.

    Distribue sous license Open-Content: http://opencontent.org/opl.shtml

  • 3

    OpenContent License Version 1.0, July 14, 1998.The original version of this document may be found at http ://opencontent.org/opl.shtml

    LICENSETerms and Conditions for Copying, Distributing, and ModifyingItems other than copying, distributing, and modifying the Content with which this license

    was distributed (such as using, etc.) are outside the scope of this license.1. You may copy and distribute exact replicas of the OpenContent (OC) as you receive it,

    in any medium, provided that you conspicuously and appropriately publish on each copy anappropriate copyright notice and disclaimer of warranty ; keep intact all the notices that referto this License and to the absence of any warranty ; and give any other recipients of the OCa copy of this License along with the OC. You may at your option charge a fee for the mediaand/or handling involved in creating a unique copy of the OC for use offline, you may at youroption offer instructional support for the OC in exchange for a fee, or you may at your optionoffer warranty in exchange for a fee. You may not charge a fee for the OC itself. You may notcharge a fee for the sole service of providing access to and/or use of the OC via a network(e.g. the Internet), whether it be via the world wide web, FTP, or any other method.

    2. You may modify your copy or copies of the OpenContent or any portion of it, thusforming works based on the Content, and distribute such modifications or work under theterms of Section 1 above, provided that you also meet all of these conditions :

    a- You must cause the modified content to carry prominent notices stating that youchanged it, the exact nature and content of the changes, and the date of any change.

    b- You must cause any work that you distribute or publish, that in whole or in partcontains or is derived from the OC or any part thereof, to be licensed as a whole at no chargeto all third parties under the terms of this License, unless otherwise permitted under applicableFair Use law.

    These requirements apply to the modified work as a whole. If identifiable sections of thatwork are not derived from the OC, and can be reasonably considered independent and separateworks in themselves, then this License, and its terms, do not apply to those sections whenyou distribute them as separate works. But when you distribute the same sections as part ofa whole which is a work based on the OC, the distribution of the whole must be on the termsof this License, whose permissions for other licensees extend to the entire whole, and thus toeach and every part regardless of who wrote it. Exceptions are made to this requirement torelease modified works free of charge under this license only in compliance with Fair Use lawwhere applicable.

    3. You are not required to accept this License, since you have not signed it. However,nothing else grants you permission to copy, distribute or modify the OC. These actions areprohibited by law if you do not accept this License. Therefore, by distributing or translatingthe OC, or by deriving works herefrom, you indicate your acceptance of this License to do so,and all its terms and conditions for copying, distributing or translating the OC.

    NO WARRANTY4. Because the opencontent (oc) is licensed free of charge, there is no warranty for the oc,

    to the extent permitted by applicable law. Except when otherwise stated in writing the copy-right holders and/or other parties provide the oc as is without warranty of any kind, eitherexpressed or implied, including, but not limited to, the implied warranties of merchantabilityand fitness for a particular purpose. The entire risk of use of the oc is with you. Should the ocprove faulty, inaccurate, or otherwise unacceptable you assume the cost of all necessary repairor correction.

    5. In no event unless required by applicable law or agreed to in writing will any copyright

    holder, or any other party who may mirror and/or redistribute the oc as permitted above, be

    liable to you for damages, including any general, special, incidental or consequential damages

    arising out of the use or inability to use the oc, even if such holder or other party has been

    advised of the possibility of such damages.

    Distribue sous license Open-Content: http://opencontent.org/opl.shtml

  • 4

    Distribue sous license Open-Content: http://opencontent.org/opl.shtml

  • Table des matieres

    1 Generalites 7

    2 Arbres 11

    3 Parcours dans les Graphes 153.1 Representation des graphes . . . . . . . . . . . . . . . . . . . . . 153.2 Structure generale des parcours . . . . . . . . . . . . . . . . . . . 15

    3.2.1 Algorithme general . . . . . . . . . . . . . . . . . . . . . . 163.2.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . 163.2.3 algorithme detaille . . . . . . . . . . . . . . . . . . . . . . 163.2.4 Complexite . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    3.3 Parcours en largeur . . . . . . . . . . . . . . . . . . . . . . . . . . 173.4 Parcours en profondeur . . . . . . . . . . . . . . . . . . . . . . . 18

    3.4.1 Description du parcours en profondeur . . . . . . . . . . . 183.4.2 Classification des arcs . . . . . . . . . . . . . . . . . . . . 18

    3.5 Plus court chemin . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    4 Graphes orientes sans circuit 214.1 Reconnaissance dun graphe oriente sans circuit . . . . . . . . . . 214.2 Tris topologiques . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.3 Decomposition en niveaux . . . . . . . . . . . . . . . . . . . . . . 234.4 Ordres gradues . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    5 Arbre couvrant de poids minimum 275.1 Caracterisation des arbres couvrants de poids minimal . . . . . . 275.2 Algorithme de Kruskal (1956) . . . . . . . . . . . . . . . . . . . . 29

    5.2.1 Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . 295.2.2 Complexite . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    5.3 Algorithme de Prim (1957) . . . . . . . . . . . . . . . . . . . . . 305.3.1 Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.3.2 Complexite . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    6 Chemin de cout minimum 336.1 Algorithme de Dijkstra . . . . . . . . . . . . . . . . . . . . . . . . 33

    6.1.1 Explication de la technique . . . . . . . . . . . . . . . . . 336.1.2 Algorithme . . . . . . . . . . . . . . . . . . . . . . . . . . 346.1.3 Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . 346.1.4 Complexite . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    6.2 Algorithme de Bellman . . . . . . . . . . . . . . . . . . . . . . . . 35

  • 6 Table des matieres

    6.2.1 Algorithme . . . . . . . . . . . . . . . . . . . . . . . . . . 366.2.2 Complexite . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    7 Facteurs dun graphe 39

    8 Couplage maximum dans les bipartis 458.1 Couplage dans les graphes quelconques . . . . . . . . . . . . . . . 458.2 Couplage des bipartis . . . . . . . . . . . . . . . . . . . . . . . . 46

    8.2.1 Graphe des plus courtes chanes C-ameliorantes . . . . . 468.2.2 Description plus formelle . . . . . . . . . . . . . . . . . . 47

    9 Connexite 51

    10 Flot maximum dans un reseau 5510.1 Methode de Ford-Fulkerson . . . . . . . . . . . . . . . . . . . . . 55

    10.1.1 Graphe des ecarts . . . . . . . . . . . . . . . . . . . . . . 5610.1.2 Chemins ameliorants . . . . . . . . . . . . . . . . . . . . . 5610.1.3 Coupes dans les reseaux . . . . . . . . . . . . . . . . . . . 56

    10.2 Algorithme dEdmonds Karp . . . . . . . . . . . . . . . . . . . . 5710.3 Methode des preflots Algorithme de Goldberg . . . . . . . . . 58

    10.3.1 Les operations de base . . . . . . . . . . . . . . . . . . . . 5810.3.2 Les operations . . . . . . . . . . . . . . . . . . . . . . . . 5810.3.3 Lalgorithme generique . . . . . . . . . . . . . . . . . . . . 5910.3.4 Validite de la methode du preflot . . . . . . . . . . . . . . 6010.3.5 Analyse de la methode du preflot . . . . . . . . . . . . . . 61

    11 Coloration de graphes 6311.1 Nombre chromatique . . . . . . . . . . . . . . . . . . . . . . . . . 63

    11.1.1 deux gros theoremes . . . . . . . . . . . . . . . . . . . . . 6311.1.2 Un probleme du a Berge . . . . . . . . . . . . . . . . . . . 6711.1.3 Des problemes plus basiques . . . . . . . . . . . . . . . . . 67

    11.2 Indice chromatique . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    Distribue sous license Open-Content: http://opencontent.org/opl.shtml

  • Chapitre 1

    Generalites

    En 1736, Euler sinteresse au probleme des ponts de Koenigsberg. Il sagit desavoir sil existe un chemin passant une fois et une seule par chaque pont de laville. Ce probleme deviendra ensuite le probleme du postier qui vise a minimiserla distance parcourue par un postier voulant desservir toute la ville.

    En 1856, Hamilton etudie un probleme apparemment aussi simple, celui detrouver un chemin passant une fois et une seule par chaque sommet dun graphe.En fait