For each vertex x, make a set that contain each vertex y that can reach x. This sets also includes x.
If you have two edges b -> a and c -> a, then if the set associated with b is a subset of the set associated with c, then the edge b -> a can be removed.
Example:
a -> b
b -> c
a -> c
The set are:
a: { a }
b: { a, b } // Can be reached from a and b
c: { a, b, c}
If you look at the edges:
b -> c
a -> c
Then you see that the set of a is a subset of b. So, the edge a -> c can be removed.
Lucas
No comments:
Post a Comment