An adjacency list represents a graph as an array of linked list.
The index of the array represents a vertex and each element in its linked list represents the other vertices that form an edge with the vertex.
Adjacency List representation
A graph and its equivalent adjacency list representation is shown below.
An...
Showing posts with label Searching Algorithm. Show all posts
Showing posts with label Searching Algorithm. Show all posts
undefined
201
Traversal meaning visiting all the nodes of a graph. Breadth first Search is also known as Breadth first traversal and is a recursive algorithm for searching all the nodes of a graph or tree data structure.
BFS algorithm
A standard BFS algorithm implementation puts each nodes of the graph or tree into one of two categories:
Visited...
undefined
201
Traversal meaning visiting all the nodes of a given graph. Depth first Search is also know as Depth first traversal. DFS is a recursive algorithm for searching all the vertices of a graph or tree.
DFS algorithm
A standard DFS implementation puts each vertex of the graph into one of two categories:
1.Visited
2. Not...