hello nowadays i am having a rough time learning graph because i face difficulty understanding adjacency matrix and list.I don't understand them very well.First help expecting from you all 1)am i the only one who faces this difficulty in these topics 2)can you drop a link to your dfs & bfs(or any other graph algorithm)implementation so that i can look upon it and try to implement them.(this will teach different ways to do same thing) 3)anyway to learn implementation effectively except geeksforgeeks(this website is good but i barely understand them :( ) PS: i have watched many video lectures but they don't teach implementation.my main point of concern is that i don't get good implementation source. asked 31 Jan '15, 13:51

I had the same problem a few months ago and I posted the same question here. I got many useful resources. Among them, my personal favorite is emaxx.ru. This is a Russian web site, so use google translator. A few pointers before you go there. p.s. BFS requires a queue. You can implement it easily. But use STL as it provides list which is easy to use and is less prone to errors. answered 31 Jan '15, 14:37
thanks...can you give a link to your dfs and bfs code along with problem link it will help me a lot..
(31 Jan '15, 15:05)
Try this problem and check out my solution
(31 Jan '15, 16:25)
Also This problem and this solution. Both problems are similar and use BFS.
(31 Jan '15, 16:27)

I faced difficulty understanding graph(/trees) and everybody does. you can see my solution to this problem. Its a very basic tree (or graph) problem. For implementation of graph, best way is to see others solutions for graph problems from codechef and codeforces. answered 31 Jan '15, 14:35

hey i am in the same boat :D but yeah i think i might be able to help you a bit.yo might google codechef tags and there you can find questions taged with bfs or dfs or whatever you want.as per implementation part i would recomend doing those question and see their editorial.i am posting a editorial of one good question as per implementation part in this editorial even code is given do see it as you will learn a lot from it.you might also see these tutorials
http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=graphsDataStrucs1
http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=graphsDataStrucs2
http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=graphsDataStrucs3
you might also search quora for this there are really really good answers for any coding problem.
this is the editorial which i was saying answered 31 Jan '15, 14:41

Hi @sneha6966.
Enjoy. answered 31 Jan '15, 14:45
thanks...can you give a link to your dfs and bfs code along with problem link it will help me a lot..
(31 Jan '15, 15:04)
