SlideShare a Scribd company logo
1 of 34
Graph Representation
What is Graph ?

          A graph G consists of a finite set of
ordered pairs, called edges E, of certain
entities called vertices V.
   Edges are also called as arcs or links.
   Vertices are also called as nodes or points.
G=(V,E)

• A graph is a set of vertices and edges. A
  vertex may represent a state or a condition
  while the edge may represent a relation
  between two vertices.
Types of Representation
      Two ways are there for representing graph
  in the memory of a computer.
They are:-
  – Sequential Representation
  – Linked Representation
Sequential Representation
        Graphs can be represented through matrix
in system’s memory. This is sequential in nature.
This type of representation is called sequential
representation of graphs.
Types of Sequential Representation
•   Adjacency Matrix Representation
•   Incidence Matrix Representation
•   Circuit Matrix Representation
•   Cut Set Matrix Representation
•   Path Matrix Representation
Linked Representation
• Graphs can be represented through Linked List
  in system’s memory. This is Linked in nature.
  This type of representation is called Linked
  representation of graphs.
Types of Linked Representation
• Adjacency List Representation
Adjacency Matrix Representation

         The Adjacency matrix of a graph G
with n vertices is N x N. It is given by A=[aij].

   aij =1 if ith and jth vertices are adjacent.
       =0 if ith and jth vertices are not adjacent.
Examples
Incidence Matrix Representation
• The Incidence matrix of a graph G with N
  vertices and E edges is N x E.

     mij = 1 if ej is incident on vi
         = 0 otherwise
Examples



           e1 e2 e3 e4

       1
       2
       3
       4
Circuit Matrix Representation
• Circuit Matrix is represented by the number of
  different circuits T and the number of edges E
  is T x E in the graph. The Circuit Matrix C=Cij.

      Cij=1 if ith circuit includes jth edge.
         = 0 otherwise.
Examples
Cut Set Matrix Representation
• A Matrix S = Sij Rows correspond to cut sets
  and columns correspond to edges of the graph
  is defined to be a cut set matrix.

     Sij = 1 if the ith cut set contains the jth edge
         = 0 otherwise
Examples
Path Matrix Representation
• A path matrix is generally defined for a
  specific pair of vertices then the path matrix
  denoted as P(u,v) = Pij .

  Pij = 1 if the jth edge lies in the ith path
     = 0 otherwise
Examples
Adjacency List representation
• Adjacency List representation is one of the
  alternatives to adjacency matrix. It requires
  less amount of memory. For every vertex
  adjacency list stores a list of vertices, which
  are adjacent to current one.
Example
In Computer’s
• Even there are many mathematical
  representations…
           adjacency matrix
                 and
           adjacency lists
  are only used for representing graphs in
  computers.
Dense Graphs and Sparse Graphs

• Dense graph is a graph in which the number
  of edges is close to the maximal number of
  edges. The opposite, a graph with only a few
  edges, is a sparse graph.
Dense Graph
Sparse Graph
Advantages of adjacency matrix

Adjacency matrix is very convenient to work
with. Add (remove) an edge can be done in
O(1) time, the same time is required to check,
if there is an edge between two vertices.
Disadvantages of adjacency matrix
• Adjacency matrix consumes huge amount of
  memory for storing big graphs.
• Adjacency matrix requires huge efforts for
  adding/removing a vertex.
• In many algorithms you need to know the edges,
  adjacent to the current vertex. To draw out such
  an information from the adjacency matrix you
  have to scan over the corresponding row, which
  results in O(|V|) complexity.
Advantages of adjacency lists
• Adjacent list allows us to store graph in more
  compact form, than adjacency matrix.
• Adjacent list allows to get the list
  of adjacent vertices in O(1) time, which is a big
  advantage for some algorithms.
Disadvantages of adjacency lists
• Adding/removing an edge to/from adjacent list is
  not so easy as for adjacency matrix. It requires,
  on the average,O(|E| / |V|) time, which may
  result in cubical complexity for dense graphs to
  add all edges.
• If there is an edge between two vertices can be
  done in O(|E| / |V|) when list of adjacent
  vertices is unordered or O(log2(|E| / |V|)) when
  it is sorted. This operation stays quite cheap.
Disadvantages of adjacency lists (cont…)
• Adjacent list doesn't allow us to make an
  efficient implementation, if dynamically
  change of vertices number is required. Adding
  new vertex can be done in O(V), but removal
  results in O(E) complexity.
Conclusion
• Adjacency matrix is good for dense graphs.
• Adjacency lists is good for sparse graphs and
  also for changing the no of nodes.
Thank You!

More Related Content

What's hot

Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Shuvongkor Barman
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structurehafsa komal
 
Hashing in datastructure
Hashing in datastructureHashing in datastructure
Hashing in datastructurerajshreemuthiah
 
Graph Basic In Data structure
Graph Basic In Data structureGraph Basic In Data structure
Graph Basic In Data structureIkhlas Rahman
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary treeKrish_ver2
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First SearchKevin Jadiya
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure pptNalinNishant3
 
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)Home
 
Bubble sort
Bubble sortBubble sort
Bubble sortManek Ar
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure Janki Shah
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra pptGirdharRatne
 
Depth first search [dfs]
Depth first search [dfs]Depth first search [dfs]
Depth first search [dfs]DEEPIKA T
 

What's hot (20)

Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
 
Hashing in datastructure
Hashing in datastructureHashing in datastructure
Hashing in datastructure
 
Graph Basic In Data structure
Graph Basic In Data structureGraph Basic In Data structure
Graph Basic In Data structure
 
Tree - Data Structure
Tree - Data StructureTree - Data Structure
Tree - Data Structure
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Trees
Trees Trees
Trees
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)
 
Binary Search
Binary SearchBinary Search
Binary Search
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Quick Sort
Quick SortQuick Sort
Quick Sort
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
Data Structure (Tree)
Data Structure (Tree)Data Structure (Tree)
Data Structure (Tree)
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Array ppt
Array pptArray ppt
Array ppt
 
Depth first search [dfs]
Depth first search [dfs]Depth first search [dfs]
Depth first search [dfs]
 

Viewers also liked

Matrix Representation Of Graph
Matrix Representation Of GraphMatrix Representation Of Graph
Matrix Representation Of GraphAbhishek Pachisia
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data StructureAnuj Modi
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphsKumar
 
Graph data structure
Graph data structureGraph data structure
Graph data structureTech_MX
 
Trees data structure
Trees data structureTrees data structure
Trees data structureSumit Gupta
 
The Graph Traversal Programming Pattern
The Graph Traversal Programming PatternThe Graph Traversal Programming Pattern
The Graph Traversal Programming PatternMarko Rodriguez
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURESbca2010
 
Skiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strcturesSkiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strctureszukun
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringSaurabh Kaushik
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treeoneous
 
Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)Trupti Agrawal
 
Network topology
Network topologyNetwork topology
Network topologytoramamohan
 

Viewers also liked (20)

Matrix Representation Of Graph
Matrix Representation Of GraphMatrix Representation Of Graph
Matrix Representation Of Graph
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
Lecture8 data structure(graph)
Lecture8 data structure(graph)Lecture8 data structure(graph)
Lecture8 data structure(graph)
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphs
 
Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]
 
Graph data structure
Graph data structureGraph data structure
Graph data structure
 
Graphs
GraphsGraphs
Graphs
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Trees data structure
Trees data structureTrees data structure
Trees data structure
 
The Graph Traversal Programming Pattern
The Graph Traversal Programming PatternThe Graph Traversal Programming Pattern
The Graph Traversal Programming Pattern
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Graph
GraphGraph
Graph
 
Skiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strcturesSkiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strctures
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning tree
 
Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)
 
Hashing
HashingHashing
Hashing
 
Network topology
Network topologyNetwork topology
Network topology
 
Syabus
SyabusSyabus
Syabus
 

Similar to Graph representation

Similar to Graph representation (20)

BRIEF RELETIONSHIP BETWEEN ADJACENCY MATRIX AND LIST.pptx
BRIEF RELETIONSHIP BETWEEN ADJACENCY MATRIX AND LIST.pptxBRIEF RELETIONSHIP BETWEEN ADJACENCY MATRIX AND LIST.pptx
BRIEF RELETIONSHIP BETWEEN ADJACENCY MATRIX AND LIST.pptx
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Graph 1
Graph 1Graph 1
Graph 1
 
Graph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxGraph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptx
 
Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructures
 
Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
 
ppt 1.pptx
ppt 1.pptxppt 1.pptx
ppt 1.pptx
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
 
graphs presentation .pptx
graphs presentation .pptxgraphs presentation .pptx
graphs presentation .pptx
 
Graphs
GraphsGraphs
Graphs
 
Graphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programGraphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ program
 
Graph Introduction.ppt
Graph Introduction.pptGraph Introduction.ppt
Graph Introduction.ppt
 
Graphs.pptx
Graphs.pptxGraphs.pptx
Graphs.pptx
 
Lec28
Lec28Lec28
Lec28
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
09_Graphs_handout.pdf
09_Graphs_handout.pdf09_Graphs_handout.pdf
09_Graphs_handout.pdf
 
Basics of graph
Basics of graphBasics of graph
Basics of graph
 
Graph
GraphGraph
Graph
 

More from Tech_MX

Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimationTech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
String & its application
String & its applicationString & its application
String & its applicationTech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application Tech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pcTech_MX
 
More on Lex
More on LexMore on Lex
More on LexTech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbmsTech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbmsTech_MX
 

More from Tech_MX (20)

Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Uid
UidUid
Uid
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
String & its application
String & its applicationString & its application
String & its application
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Spss
SpssSpss
Spss
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
 
Set data structure
Set data structure Set data structure
Set data structure
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Parsing
ParsingParsing
Parsing
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
 
More on Lex
More on LexMore on Lex
More on Lex
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 
Linkers
LinkersLinkers
Linkers
 

Recently uploaded

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Recently uploaded (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Graph representation

  • 2. What is Graph ? A graph G consists of a finite set of ordered pairs, called edges E, of certain entities called vertices V. Edges are also called as arcs or links. Vertices are also called as nodes or points.
  • 3. G=(V,E) • A graph is a set of vertices and edges. A vertex may represent a state or a condition while the edge may represent a relation between two vertices.
  • 4.
  • 5. Types of Representation Two ways are there for representing graph in the memory of a computer. They are:- – Sequential Representation – Linked Representation
  • 6. Sequential Representation Graphs can be represented through matrix in system’s memory. This is sequential in nature. This type of representation is called sequential representation of graphs.
  • 7. Types of Sequential Representation • Adjacency Matrix Representation • Incidence Matrix Representation • Circuit Matrix Representation • Cut Set Matrix Representation • Path Matrix Representation
  • 8. Linked Representation • Graphs can be represented through Linked List in system’s memory. This is Linked in nature. This type of representation is called Linked representation of graphs.
  • 9. Types of Linked Representation • Adjacency List Representation
  • 10. Adjacency Matrix Representation The Adjacency matrix of a graph G with n vertices is N x N. It is given by A=[aij]. aij =1 if ith and jth vertices are adjacent. =0 if ith and jth vertices are not adjacent.
  • 12.
  • 13. Incidence Matrix Representation • The Incidence matrix of a graph G with N vertices and E edges is N x E. mij = 1 if ej is incident on vi = 0 otherwise
  • 14. Examples e1 e2 e3 e4 1 2 3 4
  • 15. Circuit Matrix Representation • Circuit Matrix is represented by the number of different circuits T and the number of edges E is T x E in the graph. The Circuit Matrix C=Cij. Cij=1 if ith circuit includes jth edge. = 0 otherwise.
  • 17. Cut Set Matrix Representation • A Matrix S = Sij Rows correspond to cut sets and columns correspond to edges of the graph is defined to be a cut set matrix. Sij = 1 if the ith cut set contains the jth edge = 0 otherwise
  • 19. Path Matrix Representation • A path matrix is generally defined for a specific pair of vertices then the path matrix denoted as P(u,v) = Pij . Pij = 1 if the jth edge lies in the ith path = 0 otherwise
  • 21. Adjacency List representation • Adjacency List representation is one of the alternatives to adjacency matrix. It requires less amount of memory. For every vertex adjacency list stores a list of vertices, which are adjacent to current one.
  • 23.
  • 24. In Computer’s • Even there are many mathematical representations… adjacency matrix and adjacency lists are only used for representing graphs in computers.
  • 25. Dense Graphs and Sparse Graphs • Dense graph is a graph in which the number of edges is close to the maximal number of edges. The opposite, a graph with only a few edges, is a sparse graph.
  • 28. Advantages of adjacency matrix Adjacency matrix is very convenient to work with. Add (remove) an edge can be done in O(1) time, the same time is required to check, if there is an edge between two vertices.
  • 29. Disadvantages of adjacency matrix • Adjacency matrix consumes huge amount of memory for storing big graphs. • Adjacency matrix requires huge efforts for adding/removing a vertex. • In many algorithms you need to know the edges, adjacent to the current vertex. To draw out such an information from the adjacency matrix you have to scan over the corresponding row, which results in O(|V|) complexity.
  • 30. Advantages of adjacency lists • Adjacent list allows us to store graph in more compact form, than adjacency matrix. • Adjacent list allows to get the list of adjacent vertices in O(1) time, which is a big advantage for some algorithms.
  • 31. Disadvantages of adjacency lists • Adding/removing an edge to/from adjacent list is not so easy as for adjacency matrix. It requires, on the average,O(|E| / |V|) time, which may result in cubical complexity for dense graphs to add all edges. • If there is an edge between two vertices can be done in O(|E| / |V|) when list of adjacent vertices is unordered or O(log2(|E| / |V|)) when it is sorted. This operation stays quite cheap.
  • 32. Disadvantages of adjacency lists (cont…) • Adjacent list doesn't allow us to make an efficient implementation, if dynamically change of vertices number is required. Adding new vertex can be done in O(V), but removal results in O(E) complexity.
  • 33. Conclusion • Adjacency matrix is good for dense graphs. • Adjacency lists is good for sparse graphs and also for changing the no of nodes.