Strong connectivity. Strong connectivity is an equivalence relation on the set of vertices:
Reflexive: Every vertex v is. Strongly connected to itself.
Symmetric: If V is strongly connected to w then W, is strongly connected to v.
Transitive:? If V is strongly connected to W and W is strongly connected to x then V, is also strongly connected to X.
.Strong connectivity partitions the vertices into, equivalence classes which we refer to as strong components for, short. We seek to implement the following API:
API for strong components
Remarkably KosarajuSharirSCC.java implements, the API. With just a few lines of code added, to CC.java as follows:
Given a digraph G use DepthFirstOrder.java, to compute the reverse. Postorder of, its reverse GR.
.Run standard DFS, on G but consider the unmarked vertices in the order just computed instead of the standard numerical. Order.
All vertices reached on a call to the recursive DFS () from the constructor are in a strong component (!), so identify. Them as in CC.
Proposition.The Kosaraju-Sharir algorithm uses preprocessing time and space proportional to V E to support constant-time strong connectivity. Queries in a digraph.
Transitive closure. The transitive closure of a digraph G is another digraph with the same set of. Vertices but with, an edge from V to w if and only if W is reachable from V in G.
การแปล กรุณารอสักครู่..