Recall Depth-first Search (DFS), and Show that edge (u, v) is
a) a tree edge or forward edge if and only if d[u] < d[v] < f[v] < f[u]
b) a back edge if and only if d[v] < d[u] < f[u] < f[v]
c) a cross edge if and only if d[v] < f[v] < d[u] < f[u]
Solution:
By theorem, DFS of (undirected/directed) Graph let’s say G, where G= (V, E) and we have two vertices u and v such that they hold
· Vertex u and vertex v are not successor of each other, and intervals d[u], f[u], d[v] and f[v] are disjoint.
· Vertex u is descendant of vertex v and the interval d[u], f[u] is confined inside interval d[v] and f[v]
· Vertex v, descendant of vertex u and the interval of d[v] and f[v] confined inside interval d[u] and f[u]
By corollary, vertex v is a successor of vertex u if and only if d[u], is less than d[v], is less than f[v], and it is less than < f[u].
a) a tree edge or forward edge if and only if d[u] < d[v] < f[v] < f[u]
Edge (u, v) is a forward edge if and only if vertex v is a successor of vertex u, or in other case it is back edge if and only if vertex u is a successor of vertex v, or in other case it is a cross edge if and only if neither vertex u nor vertex v are successor of each other.
The edge between Vertex u and vertex v is forward edge, if vertex v is a successor of vertex u, and v is successor of vertex u if and only if we have d[u] < d[v] < f[v] < f[u] , hence it is proved
b) a back edge if and only if d[v] < d[u] < f[u] < f[v]
Let’s say edge between vertex u and vertex v is back edge then if this self-loop is a back edge then (d[v] is equal to d[u]), which is less then (f[u] equals to f[v]) holds. U is successor of vertex v and edge between u and v contains no self-loop and by corollary; d[v] < d[u] < f[u] < f[v]. Let’s say d[v] is less than and equals to d[u] and it is less then f[u] and it is less then and equals to f[v], in such case, vertex u and vertex v are same. d[v] is equals to d[u] < f[u] equals to f[v], and edge between u and v is self-loop. Hence, it is a back edge and in such case of vertex u and vertex v d[v] is less than d[u] < f[u] less than f[v],
Vertex u is a successor of vertex v, interval d[u] and f[u] is confined within d[v] and f[v], so it is back edge. Proved
c) a cross edge if and only if d[v] < f[v] < d[u] < f[u]
Let’s suppose edge between vertex u and vertex v is a cross edge. In this case neither vertex u nor vertex v is predecessor of each other. Different intervals d[u], f[u], d[v] and f[v] are separate. So either d[v] < f[v] < d[u] < f[u] is true or d[u] < f[u] < d[v] < f[v] is true. If cross edge between u and v exists then we cannot have the relationship of d[u] < d[v] as vertex v is a successor of vertex u. If relationship exists such that d[u] is less then d[v], in such case vertex v is remains white in color at d[u] time which opposes cross edge. Hence, d[v] is less then f[v] and it is less then d[u] , it is less then f[u]. By theorem, neither vertex u nor vertex v is successor of each other
Hence, the edge between vertex u and vertex v, they must have a across edge. Proved
Comments
Post a Comment