SlideServe
Menu
Préférences
© SlideServe · v2026

Understanding Directed Graph Properties & Algorithms in Large-Scale Programming

lala avatar
66 diapositives · 773 Views · Jul 29, 2014

Explore properties of Directed Graphs, reachability concepts, computing algorithms, scheduling, and transitive closure using the Floyd-Warshall Algorithm. Learn about DAG, reachability, in-edges, out-edges, adjacency matrices, and dynamic programming.

Understanding Directed Graph Properties & Algorithms in Large-Scale Programming - slide 1
01 / 66Understanding Directed Graph Properties & Algorithms in Large-Scale Programming
1 / 17

Télécharger la présentation

Understanding Directed Graph Properties & Algorithms in Large-Scale Programming
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. CSC 213 – Large Scale Programming Lecture 33:Directed Graph Connectivity

  2. Today’s Goals • Examine new properties of DirectedGraphs • What reaching & reachablemean for a Graph • How humans go about computing these properties • Algorithms for computers to compute these • Examine what meant by DAG and why you care • Simple ways to develop schedules will be examined • How can algorithm tell when a schedule impossible

  3. Directed Graph • Only directed edges • Replace undirected edge with 2 directed edges • Relationships go in only one direction • One-way streets • Flights • Scheduling E D C B A

  4. Directed Graph • Only directed edges • Replace undirected edge with 2 directed edges • Relationships go in only one direction • One-way streets • Flights • Scheduling • Talking to your ex

  5. Directed Graph Properties e • Each edge goes one-way • (a,b)connectsatob • (a,b) does not connectb to a • Can discuss in-edges & out-edges • (a,b) is out-edge for a • (a,b) is in-edge for b • Adjacency-based Graph classes can change • Use 2 Sequences for adjacency-list vertices • Define source & target dimension in adjacency-matrix incidentEdges returns both in-edges & out-edges d c b a

  6. Reachability • e,a,dreachable from c e d c f a b

  7. Reachability • e,a,dreachable from c • creaches e e d c f a b

  8. Reachability • e,a,dreachable from c • creaches e • c reaches e & eincident upond,a e d c f a b

  9. Reachability • e,a,dreachable from c • creaches e • c reaches e & eis incident upond,a • d,aout-edges to c only e d c f a b

  10. Reachability • a,c,d,e,freachablefromb e d c f a b

  11. Reachability • a,c,d,e,freachablefromb • Path exists from b to every vertex e d c f a b

  12. Reachability • a,c,d,e,freachablefromb • Path exists from b to every vertex • Actually have multiple paths to most vertices e d c f a b

  13. Transitive Closure of G • Transitive closure ofGusually written as G* d e b c a G G*

  14. Transitive Closure of G • Transitive closure ofGusually written as G* • Identical vertex sets in G & G* • G & G* have different edge sets, however d e d e b b c c a a G G*

  15. Transitive Closure of G • Transitive closure ofGusually written as G* • Identical vertex sets in G & G* • G & G* have different edge sets, however • Edge in G*if targetreachable from sourceinG d e d e b b c c a a G G*

  16. Transitive Closure of G • Transitive closure ofGusually written as G* • Identical vertex sets in G & G* • G & G* have different edge sets, however • Edge in G*if targetreachable from sourceinG d e d e b b c c a a G G*

  17. Transitive Closure of G • Transitive closure ofGusually written as G* • Identical vertex sets in G & G* • G & G* have different edge sets, however • Edge in G*if targetreachable from sourceinG d e d e b b c c a a G G*

  18. Transitive Closure of G • Transitive closure ofGusually written as G* • Identical vertex sets in G & G* • G & G* have different edge sets, however • Edge in G*if targetreachable from sourceinG d e d e b b c c a a G G*

  19. Transitive Closure of G • Transitive closure ofGusually written as G* • Identical vertex sets in G & G* • G & G* have different edge sets, however • Edge in G*if targetreachable from sourceinG d e d e b b c c a a G G*

  20. Computing Transitive Closure • Use dynamic programming to compute this • This solution known as Floyd-Warshall Algorithm • But how fast is it?

  21. Floyd-Warshall’s Algorithm • Number G’s vertices from 1 to n • Algorithm will compute n directed graphs • Set G0=G to initialize this algorithm • Graph of transitive closure is end result (Gn = G*) • All ndirected graphs have same vertices • Gk contains all edges in Gk-1 (and Gk-2, Gk-3 ,…, G0) • Gk also has edge (vi,vj)if edges (vi,vk) & (vk,vj)in Gk-1 • Takes O(n3) time with adjacency matrix • Better to use “brute force” if few edges exist

  22. Floyd-Warshall’s Algorithm • Number G’s vertices from 1 to n • Algorithm willcompute n directed graphs • Set G0=G to initialize this algorithm • Graph of transitive closure is end result (Gn = G*) • All n directed graphs have same vertices • Gk contains all edges in Gk-1(and Gk-2, Gk-3 ,…, G0) • Gk also has edge (vi,vj)if edges (vi,vk) & (vk,vj)in Gk-1 • Takes O(n3) time with adjacency matrix • Better to use “brute force” if few edges exist

  23. Floyd-WarshallExample – G0 V7 V4 V6 V2 V3 V1 V5

  24. Floyd-WarshallExample – G1 V7 V4 V6 V2 V3 V1 V5

  25. Floyd-WarshallExample – G1 V7 V4 V6 V2 V3 V1 V5

  26. Floyd-WarshallExample – G1 V7 V4 V6 V2 V3 V1 V5

  27. Floyd-WarshallExample – G1 V7 V4 V6 V2 V3 V1 V5

  28. Floyd-WarshallExample – G1 V7 V4 V6 V2 V3 V1 V5

  29. Floyd-WarshallExample – G2 V7 V4 V6 V2 V3 V1 V5

  30. Floyd-WarshallExample – G2 V7 V4 V6 V2 V3 V1 V5

  31. Floyd-WarshallExample – G3 V7 V4 V6 V2 V3 V1 V5

  32. Floyd-WarshallExample – G3 V7 V4 V6 V2 V3 V1 V5

  33. Floyd-WarshallExample – G3 V7 V4 V6 V2 V3 V1 V5

  34. Floyd-WarshallExample – G3 V7 V4 V6 V2 V3 V1 V5

  35. Floyd-WarshallExample – G3 V7 V4 V6 V2 V3 V1 V5

  36. Floyd-WarshallExample – G4 V7 V4 V6 V2 V3 V1 V5

  37. Floyd-WarshallExample – G4 V7 V4 V6 V2 V3 V1 V5

  38. Floyd-WarshallExample – G4 V7 V4 V6 V2 V3 V1 V5

  39. Floyd-WarshallExample – G4 V7 V4 V6 V2 V3 V1 V5

  40. Floyd-WarshallExample – G4 V7 V4 V6 V2 V3 V1 V5

  41. Floyd-WarshallExample – G4 V7 V4 V6 V2 V3 V1 V5

  42. Floyd-WarshallExample – G5 V7 V4 V6 V2 V3 V1 V5

  43. Floyd-WarshallExample – G5 V7 V4 V6 V2 V3 V1 V5

  44. Floyd-WarshallExample – G5 V7 V4 V6 V2 V3 V1 V5

  45. Floyd-WarshallExample – G5 V7 V4 V6 V2 V3 V1 V5

  46. Floyd-WarshallExample – G6 V7 V4 V6 V2 V3 V1 V5

  47. Floyd-WarshallExample – G6 V7 V4 V6 V2 V3 V1 V5

  48. Floyd-WarshallExample – G7 V7 V4 V6 V2 V3 V1 V5

  49. Floyd-WarshallExample – G* V7 V4 V6 V2 V3 V1 V5

  50. Directed Acyclic Graph • Often called a DAG • Number & sort vertices • Topological order found • Eachedge (vi,vj) has i < j • Finds valid schedules… • …or proves cannot exist! d e b G (is a DAG) c a 5 4 d e 1 A valid ordering of G b 3 c 2 a