SlideShare a Scribd company logo
1 of 34
Download to read offline
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.
Graph representation
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
Graph representation
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
Graph representation
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

Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)Trupti Agrawal
 
trees in data structure
trees in data structure trees in data structure
trees in data structure shameen khan
 
10.m way search tree
10.m way search tree10.m way search tree
10.m way search treeChandan Singh
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applicationsJsaddam Hussain
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Lecture optimal binary search tree
Lecture optimal binary search tree Lecture optimal binary search tree
Lecture optimal binary search tree Divya Ks
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2showslidedump
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure Meghaj Mallick
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Mohanlal Sukhadia University (MLSU)
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search treeKrish_ver2
 
Matrix Representation Of Graph
Matrix Representation Of GraphMatrix Representation Of Graph
Matrix Representation Of GraphAbhishek Pachisia
 

What's hot (20)

Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
10.m way search tree
10.m way search tree10.m way search tree
10.m way search tree
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Lecture optimal binary search tree
Lecture optimal binary search tree Lecture optimal binary search tree
Lecture optimal binary search tree
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Hashing
HashingHashing
Hashing
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Arrays
ArraysArrays
Arrays
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search tree
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Matrix Representation Of Graph
Matrix Representation Of GraphMatrix Representation Of Graph
Matrix Representation Of Graph
 

Viewers also liked

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
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structurehafsa komal
 
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
 
Network topology
Network topologyNetwork topology
Network topologytoramamohan
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashingVictor Palmar
 
2.4 Other Types of Graphs
2.4 Other Types of Graphs2.4 Other Types of Graphs
2.4 Other Types of Graphsmlong24
 

Viewers also liked (20)

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
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
 
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
 
Hashing
HashingHashing
Hashing
 
Network topology
Network topologyNetwork topology
Network topology
 
Syabus
SyabusSyabus
Syabus
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashing
 
2.4 Other Types of Graphs
2.4 Other Types of Graphs2.4 Other Types of Graphs
2.4 Other Types of Graphs
 

Similar to Graph representation

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.pptxCHIRANTANMONDAL2
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjtepournima055
 
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.pptxasimshahzad8611
 
Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructuresLikhithaGunturi
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data StructureKeno benti
 
graphs presentation .pptx
graphs presentation .pptxgraphs presentation .pptx
graphs presentation .pptxssuser800a48
 
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++ programMuhammad Danish Badar
 
Graph Introduction.ppt
Graph Introduction.pptGraph Introduction.ppt
Graph Introduction.pptFaruk Hossen
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx pptDhruvilSTATUS
 
09_Graphs_handout.pdf
09_Graphs_handout.pdf09_Graphs_handout.pdf
09_Graphs_handout.pdfIsrar63
 
Introduction to graphs and their ability to represent images
Introduction to graphs and their ability to represent imagesIntroduction to graphs and their ability to represent images
Introduction to graphs and their ability to represent imagesAnyline
 

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
 
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
 
Introduction to graphs and their ability to represent images
Introduction to graphs and their ability to represent imagesIntroduction to graphs and their ability to represent images
Introduction to graphs and their ability to represent images
 

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

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 

Recently uploaded (20)

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 

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.
  • 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.
  • 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.
  • 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.