0% found this document useful (0 votes)
37 views8 pages

Network Representation Adjacency Matrices and Adjacency Lists

Uploaded by

hebav90621
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views8 pages

Network Representation Adjacency Matrices and Adjacency Lists

Uploaded by

hebav90621
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Network Representation:

Adjacency Matrices and


Adjacency Lists
In this presentation, we'll explore two fundamental ways to
represent networks - adjacency matrices and adjacency lists. We'll
discuss the pros and cons of each approach, as well as how to
identify connected components and use search algorithms to
navigate the network.
Representing the Network
Adjacency Matrix Adjacency List

A 2D array where each cell indicates whether two A list of all the nodes, each with a list of its neighboring
nodes are connected. nodes.
Adjacency Matrices: Pros
and Cons
1 Pros 2 Cons
Constant-time lookups for Require N^2 space,
edge existence. where N is the number of
nodes.

3 Cons 4 Cons
Inefficient for sparse Difficult to iterate over a
graphs with many node's neighbors.
missing edges.
Adjacency Lists: Pros and
Cons
1 Pros 2 Pros
Require only O(|E|) space, Efficient for iterating over
where |E| is the number a node's neighbors.
of edges.

3 Cons 4 Cons
Require O(|E|) time to Can be more complex to
check if an edge exists. implement than
adjacency matrices.
Identifying Connected Components
Connected Components Importance

A connected component is a set of nodes where each Knowing the connected components is crucial for
node is reachable from every other node in the set. understanding the structure and connectivity of a
network.
Depth-First Search (DFS) Algorithm
Explore Deeply 1
DFS visits a node, then recursively explores all its
neighbors before backtracking.
2 Stack-Based
DFS uses a stack data structure to keep track of the
nodes to visit.
Connected Components 3
DFS can be used to identify the connected
components in a network.
Breadth-First Search (BFS) Algorithm
Explore Broadly 1
BFS visits a node, then explores all its neighbors
before moving on to the next level.
2 Queue-Based
BFS uses a queue data structure to keep track of the
nodes to visit.
Shortest Paths 3
BFS can be used to find the shortest paths between
nodes in a network.
Determining the Number
of Connected Regions
Key Steps Key Steps
1. Represent the network 2. Perform a DFS or BFS
using an adjacency matrix traversal to identify the
or adjacency list. connected components.

Key Steps Importance


3. Count the number of Understanding the number
unique connected of connected regions is
components to determine crucial for network
the number of connected analysis and optimization.
regions.

You might also like