SlideShare a Scribd company logo
9
Most read
11
Most read
17
Most read
Basic Traversal And Search
Techniques
Presented by
S.Vijayalakshmi I-MSC[IT]
Basic Traversal and Search Techniques
Basic Traversal and Search Techniques
Connected Components
• A connected components is a subgraph in
which any two vertices are connected to each
other by paths and which is connected to no
additional vertices of the super graph
Algorithm For Connected
Components
• Connected components(G)
For each vertex V G
Make –set (V)
For each edge (U,V) G E
If find –set(4) find-set(V)
Union(U,V)
• Same Component(U,V)
If find-set(U)= =find-set(V)
Return true
Else return false
Determining Connected
Components
void Graph::Components()
{
visited = new Boolean[n];
for(int i=0 ; i<n ; i++)
visited[i]= False;
for(i=0 ; i<n ; i++)
if(!visited[i])
{
DFS(i);
OutputNewComponent();
}
delete[]vivited;
}
Basic Traversal and Search Techniques
GRAPHS
• Graphs are one of the most interesting data
structures in computer science
• Graphs and tree are somewhat similar by their
structure and in fact tree is derived from the
graph and data structure
• Commonly used graph traversal algorithms
are:
DFS
BFS
BFS
• In this we visit the node level by
level so it will start with 0, which
is the root node then next ,then the
last level
• Queue is used to implement BFS
DFS
• In this we visit the root node first
then its children until it reaches
the end node
• Stack is used to implement DFS
Spanning Tree
• Spanning tree have a connected undirected graph
 connected : every node reachable from every other node
 Undirected: edges do not have automatic direction
• Spanning tree of the graph is a connected sub -
graph in which there are no cycles
• A spanning of a graph has no cycles but still
connects to every house
• If G is a connected graph with n vertices and m
edges, spanning tree of G must have n-1 edges ,
and no.of edges deleted from G to get a spanning
tree must be m -(n-1)=m-n+1
• A graph may have many spanning tree;for
instance the complete graph of four vertices.
A connected,
undirected graph
four of the spanning tree of the graph
Basic Traversal and Search Techniques
Biconnected Components
Basically it is a graph theory.
A graph is biconnected if it contains no
‘articulation’ points .
A components of a graph G is maximal
“biconnected subgraph”. That means it is
not contained any larger biconnected
subgraph of G
Articulation Points
Let G = (V,E) be a connected
undirected graph.
• Articulation point : is any vertex f G whose
removal result in a disconnected graph
Articulation Point
• Articulation point : is any vertex of G whose
removal results in a disconnected graph
Biconnected Components
• A graph is biconnected if it contains no
articulation points.
Basic Traversal and Search Techniques
Definition
• The aim of the DFS algorithm is travers the
graph in such a way that is try to go for from
the root node. Stack is use in the
implementation of the DFS. lets see hoe DFS
work with respect to the following graph.
• DFS – Depth First Search
• It implements stack, the concept of LIFO –
Last In First Out.
Un Directed Graph
• Let G = (N,A)be an undirected graph all of
whose nodes we wish to visit
• To carry out a depth first traversal of the graph
choose any node V N as the starting point
Directed Graph
• The algorithm is essentially the same as for
undirected graph , the different residing in the
interpretation of the word “adjacent”.
• In a directed graph, node W is an adjacent to
node V but is not adjacent to W
Basic Traversal and Search Techniques

More Related Content

PPTX
Church Turing Thesis
PDF
Algorithms Lecture 2: Analysis of Algorithms I
PPT
Chap4
PPTX
Hamiltonian path
PPT
Complexity of Algorithm
PPT
Time complexity
PDF
Algorithms Lecture 6: Searching Algorithms
PPTX
Fuzzy Clustering(C-means, K-means)
Church Turing Thesis
Algorithms Lecture 2: Analysis of Algorithms I
Chap4
Hamiltonian path
Complexity of Algorithm
Time complexity
Algorithms Lecture 6: Searching Algorithms
Fuzzy Clustering(C-means, K-means)

What's hot (20)

PPT
Unit 1 chapter 1 Design and Analysis of Algorithms
PDF
Searching and Sorting Techniques in Data Structure
PDF
Time and Space Complexity
PPT
Sets and disjoint sets union123
PPTX
Circular Queue data structure
PPTX
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
PPTX
Asymptotic Notations
PPTX
Space complexity
PPTX
Top Down Parsing, Predictive Parsing
PPTX
Divide and conquer - Quick sort
PDF
Quick Sort , Merge Sort , Heap Sort
PPTX
Advanced topics in artificial neural networks
PPTX
heap Sort Algorithm
PDF
Algorithms Lecture 8: Pattern Algorithms
PPTX
N queen problem
PPT
Sum of subsets problem by backtracking 
PPTX
Stack and Queue by M.Gomathi Lecturer
PPTX
Turing machine
PPT
Heuristic Search Techniques {Artificial Intelligence}
PPT
Graph coloring problem
Unit 1 chapter 1 Design and Analysis of Algorithms
Searching and Sorting Techniques in Data Structure
Time and Space Complexity
Sets and disjoint sets union123
Circular Queue data structure
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Asymptotic Notations
Space complexity
Top Down Parsing, Predictive Parsing
Divide and conquer - Quick sort
Quick Sort , Merge Sort , Heap Sort
Advanced topics in artificial neural networks
heap Sort Algorithm
Algorithms Lecture 8: Pattern Algorithms
N queen problem
Sum of subsets problem by backtracking 
Stack and Queue by M.Gomathi Lecturer
Turing machine
Heuristic Search Techniques {Artificial Intelligence}
Graph coloring problem
Ad

Similar to Basic Traversal and Search Techniques (20)

PPTX
DSA ppt.pptx
PDF
Unit 4.2(graphs)
PPTX
Depth first traversal(data structure algorithms)
PPTX
Lecture 2.3.1 Graph.pptx
PPTX
breadth first search
PPT
Unit VI - Graphs.ppt
PPTX
Unit 4-PartB of data design and algorithms
PPTX
PPTX
Graph data structures for ppt for understanding.pptx
PPTX
Graph Traversal Algorithms - Depth First Search Traversal
PPTX
8150.graphs
PPT
ALG5.1.pptdsfnj,sdhfjk hsdjkfhsdjkfhj ksd hfjksdhfjksd
PPTX
Data structure note
PPT
2.5 bfs & dfs 02
PPTX
Algorithms and data Chapter 3 V Graph.pptx
PDF
graphtraversals.pdf
PPT
ALG5.1.ppt
PPTX
Design and Analysis of Algorithms
PPTX
Graph traversals in Data Structures
DSA ppt.pptx
Unit 4.2(graphs)
Depth first traversal(data structure algorithms)
Lecture 2.3.1 Graph.pptx
breadth first search
Unit VI - Graphs.ppt
Unit 4-PartB of data design and algorithms
Graph data structures for ppt for understanding.pptx
Graph Traversal Algorithms - Depth First Search Traversal
8150.graphs
ALG5.1.pptdsfnj,sdhfjk hsdjkfhsdjkfhj ksd hfjksdhfjksd
Data structure note
2.5 bfs & dfs 02
Algorithms and data Chapter 3 V Graph.pptx
graphtraversals.pdf
ALG5.1.ppt
Design and Analysis of Algorithms
Graph traversals in Data Structures
Ad

More from SVijaylakshmi (13)

PPTX
client server computing.pptx
PPTX
small industries.pptx
PPTX
pseudo Color Image.pptx
PPTX
hive.pptx
PPTX
real Time data analysis.pptx
PPTX
Density based methods
PPTX
Reinforcement Learning
PPTX
Synchronization in distributed computing
PPTX
control structures
PPTX
Network security
PPTX
Swing components
PPTX
Parallel language and compiler
PPTX
Basic Traversal and Search Techniques
client server computing.pptx
small industries.pptx
pseudo Color Image.pptx
hive.pptx
real Time data analysis.pptx
Density based methods
Reinforcement Learning
Synchronization in distributed computing
control structures
Network security
Swing components
Parallel language and compiler
Basic Traversal and Search Techniques

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Machine learning based COVID-19 study performance prediction
PPTX
A Presentation on Artificial Intelligence
PDF
Modernizing your data center with Dell and AMD
PDF
Encapsulation theory and applications.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Empathic Computing: Creating Shared Understanding
NewMind AI Monthly Chronicles - July 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Dropbox Q2 2025 Financial Results & Investor Presentation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation_ Review paper, used for researhc scholars
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Machine learning based COVID-19 study performance prediction
A Presentation on Artificial Intelligence
Modernizing your data center with Dell and AMD
Encapsulation theory and applications.pdf
Advanced methodologies resolving dimensionality complications for autism neur...

Basic Traversal and Search Techniques

  • 1. Basic Traversal And Search Techniques Presented by S.Vijayalakshmi I-MSC[IT]
  • 4. Connected Components • A connected components is a subgraph in which any two vertices are connected to each other by paths and which is connected to no additional vertices of the super graph
  • 5. Algorithm For Connected Components • Connected components(G) For each vertex V G Make –set (V) For each edge (U,V) G E If find –set(4) find-set(V) Union(U,V) • Same Component(U,V) If find-set(U)= =find-set(V) Return true Else return false
  • 6. Determining Connected Components void Graph::Components() { visited = new Boolean[n]; for(int i=0 ; i<n ; i++) visited[i]= False; for(i=0 ; i<n ; i++) if(!visited[i]) { DFS(i); OutputNewComponent(); } delete[]vivited; }
  • 8. GRAPHS • Graphs are one of the most interesting data structures in computer science • Graphs and tree are somewhat similar by their structure and in fact tree is derived from the graph and data structure • Commonly used graph traversal algorithms are: DFS BFS
  • 9. BFS • In this we visit the node level by level so it will start with 0, which is the root node then next ,then the last level • Queue is used to implement BFS DFS • In this we visit the root node first then its children until it reaches the end node • Stack is used to implement DFS
  • 10. Spanning Tree • Spanning tree have a connected undirected graph  connected : every node reachable from every other node  Undirected: edges do not have automatic direction • Spanning tree of the graph is a connected sub - graph in which there are no cycles • A spanning of a graph has no cycles but still connects to every house • If G is a connected graph with n vertices and m edges, spanning tree of G must have n-1 edges , and no.of edges deleted from G to get a spanning tree must be m -(n-1)=m-n+1
  • 11. • A graph may have many spanning tree;for instance the complete graph of four vertices. A connected, undirected graph four of the spanning tree of the graph
  • 13. Biconnected Components Basically it is a graph theory. A graph is biconnected if it contains no ‘articulation’ points . A components of a graph G is maximal “biconnected subgraph”. That means it is not contained any larger biconnected subgraph of G
  • 14. Articulation Points Let G = (V,E) be a connected undirected graph. • Articulation point : is any vertex f G whose removal result in a disconnected graph
  • 15. Articulation Point • Articulation point : is any vertex of G whose removal results in a disconnected graph
  • 16. Biconnected Components • A graph is biconnected if it contains no articulation points.
  • 18. Definition • The aim of the DFS algorithm is travers the graph in such a way that is try to go for from the root node. Stack is use in the implementation of the DFS. lets see hoe DFS work with respect to the following graph. • DFS – Depth First Search • It implements stack, the concept of LIFO – Last In First Out.
  • 19. Un Directed Graph • Let G = (N,A)be an undirected graph all of whose nodes we wish to visit • To carry out a depth first traversal of the graph choose any node V N as the starting point
  • 20. Directed Graph • The algorithm is essentially the same as for undirected graph , the different residing in the interpretation of the word “adjacent”. • In a directed graph, node W is an adjacent to node V but is not adjacent to W