1 / 8

Reprezentarea grafurilor orientate

Reprezentarea grafurilor orientate. Pentru reprezentarea grafurilor orientate se poate folosi : Matricea de adiacenta ; Matricea varfuri-arce ; Liste de adiacenta ; Vectorul de arce ;. Matricea de adiacenta

damara
Download Presentation

Reprezentarea grafurilor orientate

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Reprezentareagrafurilor orientate

  2. Pentrureprezentareagrafurilor orientate se poatefolosi: • Matricea de adiacenta; • Matriceavarfuri-arce; • Liste de adiacenta; • Vectorul de arce;

  3. Matricea de adiacenta Pentru un graf cu n varfuri , matricea de adiacentaestepatratica,nesimetrica ,ale careielemente se definescastfel: aij=.. • 1, dacaexista arc de la i la j (i,j); • 0, daca nu exista arc de la i la j ; 0 0 1 1 0 0 0 0 0 0 A= 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 1 2 5 3 4

  4. Vectorul de muchii 1 2 4 3 Pentru un graf cu n varfurisi m arce , vectorul de arce are ca numar de componentevaloarea m . Fiecare element al saufiind un arc care vareprezentaextremitateainitialasiceafinala. V={(1,2),(1,3),(2,3), (4,1),(4,2)}

  5. Matriceavarfuri-arce Se face printr-o matriceB,cu n linii (-varfuri) si m coloane(-arce),in care componentaestereprezentataastfel :bij= • 1 , dacavarfuliesteextremitateinitiala a arculuiUj; • -1, dacavarfuliesteextremitatefinala a arculuiUj; • 0, daca nu existaarcul;

  6. V={(1,2),(1,4),(2,3),(2,5),(3,1),(4,3),(5,4)} u1 u2 u3 u4 u5 u6 u7 1 1 0 0 -1 0 0 -1 0 1 1 0 0 0 B= 0 0 -1 0 1 -1 0 0 -1 0 0 0 1 -1 0 0 0 -1 0 0 1 1 2 4 5 3

  7. Liste de adiacenta Pentrufiecarevarf se construiescdoualiste : • L+(x) : reprezintalistavecinilorsuccesori care continevarfurilecesuntextremitatile finale ale arcelor care ies din varful x; • L-(x) : reprezintalistavecinilorpredecesori care continevarfurilecesuntextremitatileinitiale ale arcelor care intra in varful x;

  8. 1 5 3 4 2

More Related