c - Verify if an undirected graph has cycles -


i know question has been asked times. can't understand yet , questions old reply...

i read kahn's algorithm
dfs
plus tarjan's connected components algorithm
can't understand process make work.
i've done far initialized , feed graph.
, found shortest path vertéx b.

a simple dfs little modification do.

hint: dfs traversal of given graph. every visited vertex ‘v’, if there adjacent ‘u’ such u visited , u not parent of v, there cycle in graph.

also note: cycles detection in undirected graphs follow algorithm totally different directed graphs. cycle in directed graphs diffent.

(hope comfortable dfs).


Comments

Popular posts from this blog

What Are The Best Universities In The World?

Hard vs. Soft Water: What's The Difference?

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -