


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Spring 2002 CS 357 Class Notes (^) Page 2
Spring 2002 CS 357 Class Notes (^) Page 3
CS 114
CS 124
CS 325 ECE 380
ECE 383
CS 114
CS 124
CS 325
ECE 380
ECE 383
Spring 2002 CS 357 Class Notes (^) Page 4
Spring 2002 CS 357 Class Notes Page 5
Spring 2002 CS 357 Class Notes Page 6
G (^) x G (^) x+
Spring 2002 CS 357 Class Notes (^) Page 7
Algorithm FloydWarshall(G): let v 1 , v 2 , … v (^) n be an arbitrary numbering of the vertices in G
G 0 G for k 1 to n do G (^) k G (^) k- for each i and j in {1…n} with i≠j and i&j≠k do if both edges (v (^) i,v (^) k) and (v (^) k,v (^) j ) are in G (^) k-1 then add edge (v (^) i,v (^) j) to Gk if it does not exist return G (^) n
vi
vk vj vi
vk vj
G (^) x G (^) x+
Spring 2002 CS 357 Class Notes (^) Page 8
v (^6)
v (^3)
v (^4)
v (^1)
v 2 v (^5)
v (^7)
Spring 2002 CS 357 Class Notes (^) Page 9
Spring 2002 CS 357 Class Notes (^) Page 10
CS 114
CS 124
CS 325 ECE 380
ECE 383
Spring 2002 CS 357 Class Notes Page 11
Algorithm Topological Sort(G): Let S be an initially empty stack. for each vertex u in G do Let incounter(u) be the in-degree of u. if incounter(u) = 0 then S.push(u)
i 1 while S is not empty do u S.pop() Let u be vertex number i in the ordering i i + 1 for each outgoing edge (u,w) of u do incounter(w) incounter(w) – if incounter(w) = 0 then S.push(w) Spring 2002 CS 357 Class Notes Page 12
Spring 2002 CS 357 Class Notes (^) Page 19
Spring 2002 CS 357 Class Notes (^) Page 20
Spring 2002 CS 357 Class Notes (^) Page 21