1 / 33

Reachability in Directed Graph s

Reachability in Directed Graph s. Liam Roditty. G = (V,E). G = (V,E). ũ. ũ. ṽ. ṽ. u. u. v. v. Reachability. Strong Connectivity. Is there a directed path from u to v. Is there a directed path from u to v and from v to u. G = (V,E). ũ. ṽ. u. v.

Download Presentation

Reachability in Directed Graph s

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. Reachability in DirectedGraphs Liam Roditty

  2. G = (V,E) G = (V,E) ũ ũ ṽ ṽ u u v v Reachability Strong Connectivity • Is there a directed path from u to v • Is there a directed path from u to v and from v to u G = (V,E) ũ ṽ u v Connectivity in undirected graphs • Given two vertices decide whether they are in the same component.

  3. Dynamic graph algorithms Strong Connectivity

  4. Fully dynamic reachability 4 1 5 2 3 Reachability 1,4 ? 1,2 ? Yes Yes No

  5. Decremental Reachability Total update time PvL87, FMNZ01 m2 DI’ 00 n3 BHS’ 00 mn4/3 HK’ 95 RZ’ 02 I’ 88 Just for DAGs mn t 1 n/log n m Query time

  6. Fully dynamic reachability Small Query Time: Maintain explicitly the transitive closure matrix. Query is done in O(1), each update may take (n2) time.

  7. Fully dynamic reachability Small Query Time: Maintain explicitly the transitive closure matrix. Query is done in O(1), each update may take (n2) time. Small Update Time: A data structure which may have a non-constant querytime but with smaller update time. Open problem: Is it possible to break the (n2) update barrier ? Yes:Updates in O(m+n log n) and queries in O(n)

  8. Fully Dynamic Reachability m n  n2 n RZ’ 03  DAG DI’ 00 n1.575 n n  m+n logn Today n0.575 n  Update time General graphs mn t DI’ 00 R’ 03 S’04 n2 n t 1 n m Query time

  9. An overview of the algorithm Our algorithm supports the following operations: Insert(Ew) – Insert the edges Ewall touching w into the graph Delete(E’ ) – Delete all edges of E’ from the graph Query(u,v) – Check whether there is a directed path from u to v Insert(Ev) Insert(Eu) G(V,E0) G(V,E0Ev) G(V,E0Ev Eu)

  10. v x y x v u y An overview of the algorithm Insert(Ev) Insert(Eu) G(V,E0) G(V,E0Ev) G(V,E0Ev Eu) Our algorithm works as follows: Insert( Ew ): Create two trees to capture new paths Query(u ,v ):w, u  Tin(w)  v  Tout(w) Delete( E’ ): Delete E’ from all trees

  11. An overview of the algorithm In(v1) … v2 v3 vl v1 Out(v1) Insert(Ev1) Insert(Ev2) Insert(Ev3) Insert(Evl) The main problem is to delete edges efficiently from this forest.

  12. A simple solution for DAGs O (m+n) Insert( Ew ) O (n ) Query(u ,v) Delete( E’ ) O (1 ) … v2 v3 vl v1 The total time required to maintain a decremental single source reachability (DSSR) tree in directed acyclic graph is only O(m) (Itliano ’88)  Each edge is scanned only once in each tree

  13. Decremental reachability tree Tin(v) v v Tout(v) • Every edge is examined only once! (If the graph is DAG) • Total complexity is O(m).

  14. The problem with general graphs O (mn) Insert( Ew ) O (n ) Query(u ,v) Delete( E’ ) O (1 ) … v2 v3 vl v1 There is not any obvious way to generalize Itliano’s algorithm to general graphs. The best algorithm for DSSR requires O(mn) time. O (m+n log n) O (n ) O (m+n log n)

  15. Our Solution … v2 v3 vl v1 Maintain the trees with respect to Strongly Connected Components Problem 1: We may have n trees each with different components! Problem 2: When a component is decomposed we have to update the edges such that an edge is never examine twice!

  16. In(v1) In(v2) In(v4) In(v5) In(v3) v5 v4 v3 v1 v2 Out(v4) Out(v1) Out(v2) Out(v3) Out(v5) We solve Problem 1using fully dynamic strong connectivity algorithm with update time of O(m(m,n)). Detect and report on decompositions Fully dynamic strong connectivity with “persistency” Updating edge lists Updating edge lists

  17. G1=(V,E1) G0=(V,E0) G2=(V,E2) G0=(V,E0) G1=(V,E1) G1=(V,E0UE’) G2=(V,E1UE’’) Fully dynamic strong connectivity Supported operations: O (m(m,n)) Insert( E’ ) – Create a new version and add E’ to it. O (m(m,n)) Delete( E’)– Delete the set E’ from all versions. O (1) Query(u,v,i)– Are u and v in the same component in Gi Insert(E’) Insert(E’’) Note that these operations create a graph sequence G0(V,E0), G1(V,E1), … , Gt(V,Et) where E0 E1…  Et . This containment is kept during all the update operations!

  18. The forest: G0 G1 G2 G3 G0 G1 G2 G3 Fully dynamic strong connectivity The components of all the graphs in the sequence are arranged in a hierarchy and can be represented as a forest of size O(n) The components: 1 Version tag u 1 2 v 1 3 Query(u,v,1)  Version( LCA(u,v) )  1 Query(u,v,2)  Version( LCA(u,v) )  2

  19. Gi-1=(V,Ei-1) Gi+1=(V,Ei+1) A new partitioning of the edges E1,…, Et Definition 1: A partitioning of the graph sequence edges Hi = { (u,v) Ei| Query(u,v,i)  (Query(u,v,i-1)(u,v)Ei-1) } Ht+1 = Et \ U Hi t i=1 Hi Hi+1 Gi=(V,Ei) t+1 Hi Hj = ø,Et = U Hi U i=1

  20. Processing a deletion FindScc(H1,1) FindScc(H2,2) FindScc(H3,3) Shift(H2,H3) Shift(H3,H4) Shift(H1,H2) G0 G2 G3 G1 Hi edges Before… After ! Cost Analysis: Note that an edge enters and leave Hi just once Moving edges – Paid by the creation of the version they enter. Free Fixed edges – Paid by the current delete operation O(m)

  21. Processing a deletion FindScc(H1,1) FindScc(H2,2) FindScc(H3,3) Shift(H2,H3) Shift(H3,H4) Shift(H1,H2) G0 G2 G3 G1 Hi edges Before… After ! Cost Analysis: Note that an edge enters and leave Hi just once Moving edges – Paid by the creation of the version they enter. Free Fixed edges – Paid by the current delete operation O(m)

  22. The component forest G0 G2 G3 G1

  23. In(v1) In(v2) In(v4) In(v5) In(v3) v5 v4 v3 v1 v2 Out(v4) Out(v1) Out(v2) Out(v3) Out(v5) We solve Problem 1using fully dynamic strong connectivity algorithm with update time of O(m(m,n)). Detect and report on decompositions Fully dynamic strong connectivity with “persistency” Updating edge lists Updating edge lists

  24. Decremental reachability tree • When a decomposition is reported (by the strong • connectivity algorithm), we need to: • Build the data for the new components • Connect the new components to the tree O(n log n) O(m)

  25. component v in[v] Decremental reachability treeData structures • The list in[v] contains only uninspected incoming edges. • The list out[v] contains all the outgoing edge. • A vertexv is active if in[v] is not empty Every component maintains a list of its active vertices Tree invariant:The first edge of the first vertex in the component active vertices list is the edge that connects the component to the tree. If the component is not connected then its active vertices list is empty

  26. Decremental reachability treeEdge deletion - An uninspected incoming edge - An active vertex - A tree edge - A none active vertex - A deleted edge component Deletions of non tree edges Deletions of a tree edge – we search for an edge (u,v) such that the component that contains u satisfies the treeinvariant

  27. Decremental reachability tree Disconnecting a component - An uninspected incoming edge - An active vertex - A tree edge - A none active vertex - A deleted edge component Disconnecting a component. How do we find the components vertices ?

  28. The component forest component G0 G2 G3 G1 u Out[u]

  29. Decremental reachability tree We generalized the decremented reachability tree to general graphs by using the components of the graph. Each edge in the connection process is still scanned only once. We have to deal with decomposition. We like to create active lists for new components in efficient way.

  30. component Component1 Size =2 Component2 Size = 5 Decremental reachability tree Decomposition The component decomposed to two new components one of size 5 and one of size 2. • The largest components among the new components inherits • the list of the decomposed component. • Using the component forest each vertex from a small component is removed from the list and added to its new component list.

  31. Component1 Size =2 Component2 Size = 5 Decremental reachability tree Analysis Let’s analyze the total cost: Scanning the component vertices can be done in time proportional to the component size. We only scan ‘small’ components. If a vertex is moved from one active list to another, the size of the component containing it must have decreased by a factor of at least 2. Thus, the total time is only O(n log n) !

  32. Summing up • The total connection cost is O(m) • The total decomposition cost is O(n log n) For each tree Each update costs O(m + n log n)

  33. Openproblems • Reduce the query time to m/n ? • Reduce the update time to O(m+n) ? • Design other fully dynamic algorithm for a graph sequence ? • A single decremental reachability tree in general graph in o(mn) ?

More Related