JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label Graph-Traversal-Algorithm. Show all posts
Showing posts with label Graph-Traversal-Algorithm. Show all posts

Graph Traversal Algorithm

11:03 PM
Graph Traversal Algorithm In this part of the tutorial we will discuss the techniques by using which, we can traverse all the vertices of the graph. Traversing the graph means examining all the nodes and vertices of the graph. There are two standard methods by using which, we can traverse the graphs. Lets discuss each one of them in detail. Breadth First Search Depth First Search Breadth First Search (BFS) Algorithm Breadth first search is a graph traversal algorithm that starts traversing the graph from root node and explores all the neighbouring nodes. Then, it selects the nearest node and explore all the unexplored nodes. The algorithm follows the same process for each of the nearest node until it finds the goal. The algorithm of breadth first search is given below. The algorithm starts with examining the node A and all of its neighbours. In the next step, the neighbours of the nearest node of A are explored and process continues in the further steps. The algorithm e...

.