Sunday, June 15, 2014

Graphs


Depth First Search (DFS) - Graphs
In DFS, we start from a vertex and try to move forward and explore vertices, till we find that all the next edges lead to vertices which have already been visited. Then we backtrack along the same path, and try to explore other possibilities.
Read more...




Breadth First Search (BFS) - Graphs
In BFS, there is a notion of starting vertex. BFS visits all the vertices of a connected graph, and in the process of doing so it labels all the vertices with a distance value, which is equal to the length of the shortest path from the starting vertex to all the other vertices.
Read more...



No comments :

Post a Comment