[prev] 113 [next]

Transitive Closure (cont)

Goal: produce a matrix of reachability values
  • if tc[s][t] is 1, then t is reachable from s
  • if tc[s][t] is 0, then t is not reachable from s
So, how to create this matrix?

Observation:

∀ i,s,t ∈ vertices(G):
   (s,i) ∈ edges(G) and (i,t) ∈ edges(G)  ⇒  tc[s][t] = 1

tc[s][t]=1 if there is a path from s to t via some i    (s→i→t)