How to solve graph question

I am a beginner in Graph. I solve problem of other tag but when i saw Graph tag then I unable to solve it. Some time i understand the approach but unble to implement the code.Please suggest me way to remove the fear of graph question and provide me some useful link from where i can understand…

5 Likes

http://www.iarcs.org.in/inoi/online-study-material/topics/graphs.php
hope this will be useful for you.

4 Likes

Try solving FIRESC . First think of the right way of solving the problem within time limit and then try implementing it.
Read Intro to Graphs and their Data Structures if you have any difficulty.

2 Likes

Here are a few simple steps to be followed in order:

  1. Learn what is a graph and tree mathematically. Try to solve simple mathematical questions related to them. example prove a tree has no cycles or adding another edge to a minimum spanning tree will result in a cycle. These are simple proofs but will help you get familiar with the concept

2)Learn the ways of representing a graph on a computer (adjacency matrix,adjacency list). If you are using C , the i would suggest you learn the use of vectors in C++. It is easier to
represent graphs by vectors.

3)Learn what is DFS and BFS and its applications. First learn it theoretically and then look at the coding part. Try to implement it by yourself . They are barely 5-10 lines of code but very important concepts. Most of the easy graph questions are based on these concepts.

  1. Look at the Minimum spanning tree and Shortest path algorithms for graphs. They are slightly tricky to implement but will be easy once you practice.

The main thing about graphs is practice. Just try to understand the question and look at which concept is to be used. I would suggest you start with simple DFS questions and then move on to BFS and other tougher questions

4 Likes
//