Chapter 6 - DS
Chapter 6 - DS
• Disadvantages:
1. The adjacency list allows testing whether two
vertices are adjacent to each other but it is
slower to support this operation.
Traversal of graphs
• Graph traversal is a technique used for a
searching vertex in a graph. ...
• It is also use to calculate the order of vertices in
traverse process
• A graph traversal finds the edges to be used in
the search process without creating loops. That
means using graph traversal we visit all the
vertices of the graph without getting into looping
path.
• Two types of traversal algorithms-
1. Breadth First Search
2. Depth First Search.
DFS (Depth First Search)
• DFS traversal of a graph produces a spanning tree as final
result.
• It is a edge based technique.
•
• A, B, D, C, E, F
A spanning tree is a tree that connects all the
vertices of a graph with the minimum possible
number of edges.
BFS (Breadth First Search)
A, B, C, D, E, F
Steps to implement DFS traversal...
• H (2345) = 23 + 45 = 68
Collision
When the two different input values have the same index value, then
the problem occurs between the two input values, known as a
collision.
Therefore, two values are stored at the same index, i.e. at index 6,
and this leads to the collision problem.