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 e-maxx.ru. This is a Russian web site, so use google translator.
A few pointers before you go there.
First learn adjacency matrix for undirected graph. It is a bit easier and easy to visualize as it considers all possibilities.
Implement breadth first search and depth first search on adjacency matrix and solve a few easy problems on it.
Most graph searching problems rely on connected components which is just a simple extension of regular traversal. (Ask if you are having trouble with it after learning dfs and bfs).
After that, learn a few problems that are basically just a bit extension of the bfs and dfs like connected components and few others(I can’t recall right now, sorry).
Then learn these above for directed graph and try to understand topological sort, finding articulation points, bridges etc. (e-maxx.ru).
All the above will work if number of vertices are small. If not, you need adjacency matrix. So learn it now.
If you still have problem, just try to implement and then ask with your code. It is easier to understand when a fault is found in your own code, rather in some one else’s code.
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.
hey i am in the same boat 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
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
a link for the tagged problems of bfs http://www.codechef.com/tags/problems/bfs do some questions from here and do those which have more submission so it is to see the understandable code from others.
hope this help as i said earlier i am in the same boat …
Yes you are right. For beginners ( and sometimes for experienced coders also ) trees and graph theories are difficult to understand and comprehend.
No, I’m sure you are not the only one facing such difficulty.
Check this and this. Also go through the wiki articles about these topics and search online for codes/help but do not implement blindly. Understand/modify /alter to suit your needs. Go through the links in other answers. @dragonemperor provided some very good basic steps for your problem.
Geekforgeeks is a good site but if you are facing difficulty then ask for help there or go through different sites. Read books on Algorithm by Cormen or any other author (as you like) and go through tutorials, editorials on codechef, topcoder, codeforces, spoj.
Always practice what you have learnt. Implement your logic into code and evaluate them. Test your code in various graph/tree problems available on codechef ( or other places) and check if your implementations are correct. If wrong, try again. If TLE then use efficient approach. Practice is the key to understand such problems ( actually all problems) .