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
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.
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
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
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
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
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*
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*
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*
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*
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*
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*
Computing Transitive Closure • Use dynamic programming to compute this • This solution known as Floyd-Warshall Algorithm • But how fast is it?
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
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
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
Connexion au compte
Connectez-vous pour publier votre contenu sur SlideServe.