Yes I also initially thought so....But how do we take into consideration the edge weights??The cycle can include such edges whose total cost may come negative..... Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com
On Thu, Jan 5, 2012 at 10:01 PM, karthikeyan muthu < [email protected]> wrote: > find the size of smallest cycle in the given graph ... tarjan should do > the trick.. dfs basically ... :) > > > On Thu, Jan 5, 2012 at 7:02 PM, WgpShashank <[email protected]>wrote: > >> @Saurabh.... DFS Should Work Here, Start from any room i , visit next >> room connected to it .. then to this room & so on , once you back track >> you will back to the starting node ,this way you can find out .min.umber of >> room he need to visit will be 2 times of traversal isn't it ? >> >> >> posting the soln in hurry :), i know may have some bugs , will discuss >> after some time. >> >> Thanks >> Shashank >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/El6uttSxuA0J. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
