Dfs can be applied on undirected graph?
Answers
Answered by
5
===
( U )
===
|\
| \
| \
| \
| \ ====
| \ ___ ( B )
| / ====
| /
| /
| /
| /
|/
===
( V )
===
⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴
A depth first search on a directed graph can yield 4 types of edges; tree, forward, back and cross edges. As we are looking at undirected graphs, it should be obvious that forward and back edges are the same thing, so the only things left to deal with are cross edges.
A cross edge in a graph is an edge that goes from a vertex to another vertex such that is neither an ancestor nor descendant of . So what you need to argue is that in an
undirected graph, there's no way you can get a cross edge. It might help to think of why the can occur in directed graphs, and why you can't have this case in undirected graph.. ☺
⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵
( U )
===
|\
| \
| \
| \
| \ ====
| \ ___ ( B )
| / ====
| /
| /
| /
| /
|/
===
( V )
===
⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴⤴
A depth first search on a directed graph can yield 4 types of edges; tree, forward, back and cross edges. As we are looking at undirected graphs, it should be obvious that forward and back edges are the same thing, so the only things left to deal with are cross edges.
A cross edge in a graph is an edge that goes from a vertex to another vertex such that is neither an ancestor nor descendant of . So what you need to argue is that in an
undirected graph, there's no way you can get a cross edge. It might help to think of why the can occur in directed graphs, and why you can't have this case in undirected graph.. ☺
⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵⤵
Answered by
0
hola mate your answer is in attachment❤
Attachments:
Similar questions