SlideShare a Scribd company logo
1 of 42
1
Chapter 9:
Graph Theory
2
§9.1: Graphs and Graph Models
• Correspond to symmetricCorrespond to symmetric
binary relationsbinary relations RR..
• AA simple graphsimple graph GG=(=(VV,,EE))
consists of:consists of:
– a seta set VV ofof verticesvertices oror nodesnodes ((VV corresponds tocorresponds to
the universe of the relationthe universe of the relation RR),),
– a seta set EE ofof edgesedges // arcsarcs // linkslinks:: unordered pairsunordered pairs ofof
[distinct?][distinct?] elementselements uu,,vv ∈∈ VV, such that, such that uRvuRv..
Visual Representation
of a Simple Graph
§ 9.1 – Graphs and Graph Models
3
• LetLet VV be the set of states in the far-be the set of states in the far-
southeastern U.S.:southeastern U.S.:
–VV={FL, GA, AL, MS, LA, SC, TN, NC}={FL, GA, AL, MS, LA, SC, TN, NC}
• LetLet EE={{={{uu,,vv}|}|uu adjoinsadjoins vv}}
={{FL,GA},{FL,AL},{FL,MS},={{FL,GA},{FL,AL},{FL,MS},
{FL,LA},{GA,AL},{AL,MS},{FL,LA},{GA,AL},{AL,MS},
{MS,LA},{GA,SC},{GA,TN},{MS,LA},{GA,SC},{GA,TN},
{SC,NC},{NC,TN},{MS,TN},{SC,NC},{NC,TN},{MS,TN},
{MS,AL}}{MS,AL}}
Example of a Simple Graph
TN
ALMS
LA
SC
GA
FL
NC
§ 9.1 – Graphs and Graph Models
4
Multigraphs
• Like simple graphs, butLike simple graphs, but there may bethere may be moremore
than onethan one edge connecting two given nodesedge connecting two given nodes..
• AA multigraphmultigraph GG=(=(VV,, EE,, ff ) consists of a set) consists of a set VV
of vertices, a setof vertices, a set EE of edges (as primitiveof edges (as primitive
objects), and a functionobjects), and a function
ff::EE→→{{{{uu,,vv}|}|uu,,vv∈∈VV ∧∧ uu≠≠vv}.}.
• E.g., nodes are cities, edgesE.g., nodes are cities, edges
are segments of major highways.are segments of major highways.
Parallel
edges
§ 9.1 – Graphs and Graph Models
5
Pseudographs
• Like a multigraph, butLike a multigraph, but edges connecting aedges connecting a
node to itself are allowednode to itself are allowed..
• AA pseudographpseudograph GG=(=(VV,, EE,, ff ) where) where
ff::EE→→{{{{uu,,vv}|}|uu,,vv∈∈VV}. Edge}. Edge ee∈∈EE is ais a looploop ifif
ff((ee)={)={uu,,uu}={}={uu}}..
• E.g.E.g., nodes are campsites, nodes are campsites
in a state park, edges arein a state park, edges are
hiking trails through the woods.hiking trails through the woods.
§ 9.1 – Graphs and Graph Models
loops
6
Directed Graphs
• Correspond to arbitrary binary relationsCorrespond to arbitrary binary relations RR,,
which need not be symmetric.which need not be symmetric.
• AA directed graphdirected graph ((VV,,EE) consists of a set of) consists of a set of
verticesvertices VV and a binary relationand a binary relation EE onon VV..
• E.g.E.g.:: VV = people,= people,
EE={(={(xx,,yy) |) | xx lovesloves yy}}
• ee=(=(uu,,vv) ,) ,uu,,vv∈∈VV
§ 9.1 – Graphs and Graph Models
7
Directed Multigraphs
• Like directed graphs, but there may be moreLike directed graphs, but there may be more
than one arc from a node to another.than one arc from a node to another.
• AA directed multigraphdirected multigraph GG=(=(VV,, EE,, ff ) consists) consists
of a setof a set VV of vertices, a setof vertices, a set EE of edges, and aof edges, and a
functionfunction ff::EE→→VV××VV..
• E.g.,E.g., VV=web pages,=web pages,
EE=hyperlinks.=hyperlinks. The WWW isThe WWW is
a directed multigraph...a directed multigraph...
§ 9.1 – Graphs and Graph Models
8
Types of Graphs: Summary
• Summary of the book’s definitions.Summary of the book’s definitions.
• Keep in mind this terminology is not fullyKeep in mind this terminology is not fully
standardized...standardized...
Term
Edge
type
Multiple
edges ok?
Self-
loops ok?
Simple graph Undir. No No
Multigraph Undir. Yes No
Pseudograph Undir. Yes Yes
Directed graph Directed No Yes
Directed multigraph Directed Yes Yes
§ 9.1 – Graphs and Graph Models
9
§9.2: Graph Terminology
• Adjacent, connects, endpoints, degree,Adjacent, connects, endpoints, degree,
initial, terminal, in-degree, out-degree,initial, terminal, in-degree, out-degree,
complete, cycles, wheels, n-cubes, bipartite,complete, cycles, wheels, n-cubes, bipartite,
subgraph, union.subgraph, union.
§ 9.2 – Graph Terminology
10
Adjacency
LetLet GG be an undirected graph with edge setbe an undirected graph with edge set EE..
LetLet ee∈∈EE be (or map to) the pair {be (or map to) the pair {uu,,vv}. Then}. Then
we say:we say:
• uu,, vv areare adjacentadjacent // neighborsneighbors // connectedconnected..
• EdgeEdge ee isis incident withincident with verticesvertices uu andand vv..
• EdgeEdge ee connectsconnects uu andand vv..
• VerticesVertices uu andand vv areare endpointsendpoints of edgeof edge ee..
§ 9.2 – Graph Terminology
11
Degree of a Vertex
• LetLet GG be an undirected graph,be an undirected graph, vv∈∈VV a vertex.a vertex.
• TheThe degreedegree ofof vv, deg(, deg(vv), is its number of), is its number of
incident edges. (Except that any self-loopsincident edges. (Except that any self-loops
are counted twice.)are counted twice.)
• A vertex with degree 0 isA vertex with degree 0 is isolatedisolated..
• A vertex of degree 1 isA vertex of degree 1 is pendantpendant..
§ 9.2 – Graph Terminology
12
Handshaking Theorem
• LetLet GG be an undirected (simple, multi-, orbe an undirected (simple, multi-, or
pseudo-) graph with vertex setpseudo-) graph with vertex set VV and edgeand edge
setset EE. Then. Then
• Corollary: Any undirected graph has anCorollary: Any undirected graph has an
even number of vertices of odd degreeeven number of vertices of odd degree..
Ev
Vv
2)deg( =∑∈
§ 9.2 – Graph Terminology
13
Directed Adjacency
• LetLet GG be a directed (possibly multi-) graph,be a directed (possibly multi-) graph,
and letand let ee be an edge ofbe an edge of GG that is (or maps to)that is (or maps to)
((uu,,vv). Then we say:). Then we say:
– uu isis adjacent toadjacent to vv,, vv isis adjacent fromadjacent from uu
– ee comes fromcomes from uu,, ee goes togoes to vv..
– e connects u to ve connects u to v,, e goes from u to ve goes from u to v
– thethe initial vertexinitial vertex ofof ee isis uu
– thethe terminal vertexterminal vertex ofof ee isis vv
§ 9.2 – Graph Terminology
14
Directed Degree
• LetLet GG be a directed graph,be a directed graph, vv a vertex ofa vertex of GG..
– TheThe in-degreein-degree ofof vv, deg, deg−−
((vv), is the number of), is the number of
edges going toedges going to vv..
– TheThe out-degreeout-degree ofof vv, deg, deg++
((vv), is the number of), is the number of
edges coming fromedges coming from vv..
– TheThe degreedegree ofof vv, deg(, deg(vv))≡≡degdeg−−
((vv)+deg)+deg++
((vv), is the), is the
sum ofsum of vv’s in-degree and out-degree.’s in-degree and out-degree.
§ 9.2 – Graph Terminology
15
Directed Handshaking Theorem
• LetLet GG be a directed (possibly multi-) graphbe a directed (possibly multi-) graph
with vertex setwith vertex set VV and edge setand edge set EE. Then:. Then:
• Note that the degree of a node is unchangedNote that the degree of a node is unchanged
by whether we consider its edges to beby whether we consider its edges to be
directed or undirected.directed or undirected.
Evvv
VvVvVv
=== ∑∑∑ ∈∈
+
∈
−
)deg(
2
1
)(deg)(deg
§ 9.2 – Graph Terminology
16
Special Graph Structures
Special cases of undirected graph structures:Special cases of undirected graph structures:
• Complete graphsComplete graphs KKnn
• CyclesCycles CCnn
• WheelsWheels WWnn
• nn-Cubes-Cubes QQnn
• Bipartite graphsBipartite graphs
• Complete bipartite graphsComplete bipartite graphs KKmm,,nn
§ 9.2 – Graph Terminology
17
Complete Graphs
• For anyFor any nn∈∈NN, a, a complete graphcomplete graph onon nn
vertices,vertices, KKnn, is a simple graph with, is a simple graph with nn nodesnodes
in which every node is adjacent to everyin which every node is adjacent to every
other node:other node: ∀∀uu,,vv∈∈VV:: uu≠≠vv↔↔{{uu,,vv}}∈∈EE..
Note that Kn has edges.2
)1(1
1
−
=∑
−
=
nn
i
n
i
K1 K2
K3 K5 K6
K4
§ 9.2 – Graph Terminology
18
Cycles
• For anyFor any nn≥≥3, a3, a cyclecycle onon nn vertices,vertices, CCnn, is a, is a
simple graph wheresimple graph where VV={={vv11,,vv22,… ,,… ,vvnn} and} and
EE={{={{vv11,,vv22},{},{vv22,,vv33},…,{},…,{vvnn−−11,,vvnn},{},{vvnn,,vv11}}.}}.
C3 C4 C5 C6 C7
C8
How many edges are there in Cn?
§ 9.2 – Graph Terminology
19
Wheels
• For anyFor any nn≥≥3, a3, a wheelwheel WWnn, is a simple graph, is a simple graph
obtained by taking the cycleobtained by taking the cycle CCnn and addingand adding
one extra vertexone extra vertex vvhubhub andand nn extra edgesextra edges
{{{{vvhubhub,,vv11}, {}, {vvhubhub,,vv22},…,{},…,{vvhubhub,,vvnn}}.}}.
How many edges are there in Wn?
W3
W5 W6 W7
W8
W4
§ 9.2 – Graph Terminology
20
n-cubes (hypercubes)
• For anyFor any nn∈∈NN, the hypercube, the hypercube QQnn is a simpleis a simple
graph consisting of two copies ofgraph consisting of two copies of QQnn-1-1
connected together at corresponding nodes.connected together at corresponding nodes.
QQ00 has 1 node.has 1 node.
Q0
Q1 Q2 Q3 Q4
Number of vertices: 2n
. Number of edges:Exercise to try!
§ 9.2 – Graph Terminology
21
n-cubes (hypercubes)
• For anyFor any nn∈∈NN, the hypercube, the hypercube QQnn can becan be
defined recursively as follows:defined recursively as follows:
– QQ00={{={{vv00},},∅∅} (one node and no edges)} (one node and no edges)
– For anyFor any nn∈∈NN, if Q, if Qnn==((VV,,EE), where), where VV={={vv11,…,,…,vvaa}}
andand EE={={ee11,…,,…,eebb}, then}, then QQnn+1+1=(=(VV∪∪{{vv11´,…,´,…,vvaa´},´},
EE∪∪{{ee11´,…,´,…,eebb´}´}∪∪{{{{vv11,,vv11´},{´},{vv22,,vv22´},…,´},…,
{{vvaa,,vvaa´}}) where´}}) where vv11´,…,´,…,vvaa´ are new vertices, and´ are new vertices, and
where ifwhere if eeii={={vvjj,,vvkk} then} then eeii´={´={vvjj´,´,vvkk´}.´}.
§ 9.2 – Graph Terminology
22
Bipartite Graphs
• AA simple graphsimple graph GG is calledis called bipartitebipartite if itsif its
vertex setvertex set VV can be partitioned into twocan be partitioned into two
disjoint setsdisjoint sets VV1 andand VV2 such thatsuch that every edgeevery edge
in the graph connects a vertex inin the graph connects a vertex in VV1 and aand a
vertex invertex in VV2(so that no edge in(so that no edge in GG connectsconnects
either two vertices ineither two vertices in VV1 or two vertices inor two vertices in
VV2))
§ 9.2 – Graph Terminology
23
Complete Bipartite Graphs
• TheThe complete bipartite graphcomplete bipartite graph KKm,n that has itsthat has its
vertex set partitioned into two subsets ofvertex set partitioned into two subsets of mm
andand nn vertices, respectively. There is anvertices, respectively. There is an
edge between two verticesedge between two vertices iffiff one vertex isone vertex is
in the first subset and the other is in thein the first subset and the other is in the
second subsetsecond subset..
§ 9.2 – Graph Terminology
24
Subgraphs
• A subgraph of a graphA subgraph of a graph GG=(=(VV,,EE) is a graph) is a graph
HH=(=(WW,,FF) where) where WW⊆⊆VV andand FF⊆⊆EE..
G H
§ 9.2 – Graph Terminology
25
Graph Unions
• TheThe unionunion GG11∪∪GG22 of two simple graphsof two simple graphs
GG11=(=(VV11,, EE11) and) and GG22=(=(VV22,,EE22) is the simple) is the simple
graph (graph (VV11∪∪VV22,, EE11∪∪EE22).).
§ 9.2 – Graph Terminology
26
§9.3: Graph Representations &
Isomorphism
• Graph representations:Graph representations:
– Adjacency lists.Adjacency lists.
– Adjacency matrices.Adjacency matrices.
– Incidence matrices.Incidence matrices.
• Graph isomorphism:Graph isomorphism:
– Two graphs are isomorphic iff they are identicalTwo graphs are isomorphic iff they are identical
except for theirexcept for their node namesnode names..
§ 9.3 – Graph Representations & Isomorphism
27
Adjacency Lists
• A table with 1 row per vertex, listing itsA table with 1 row per vertex, listing its
adjacent vertices.adjacent vertices.
a b
dc
f
e
Vertex
Adjacent
Vertices
a
b
c
d
e
f
§ 9.3 – Graph Representations & Isomorphism
28
Directed Adjacency Lists
• 1 row per node, listing the terminal nodes of1 row per node, listing the terminal nodes of
each edge incident from that node.each edge incident from that node.
§ 9.3 – Graph Representations & Isomorphism
a b
dc
f
e
Initial
Vertex
Terminal
Vertices
a
b
c
d
e
f
29
Adjacency Matrices
• MatrixMatrix AA=[=[aaijij], where], where aaijij isis 11 if {if {vvii,, vvjj} is an} is an
edge ofedge of GG,, 00 otherwise.otherwise.
a b
c d












0001
0011
0101
1110
a b
d c












0212
2110
1103
2030
§ 9.3 – Graph Representations & Isomorphism
30
Incidence Matrices
• MatrixMatrix AA=[=[aaijij]]vxe, where, where aaijij isis 11 ifif eejj incidentincident
withwith vvii,, 00 otherwise.otherwise.
b c
d
e
















011010
000101
110000
101100
000011a
1
23
4
5
6
§ 9.3 – Graph Representations & Isomorphism
31
Graph Isomorphism
• Formal definition:Formal definition:
– Simple graphsSimple graphs GG11=(=(VV11,, EE11) and) and GG22=(=(VV22,, EE22) are) are
isomorphicisomorphic iffiff ∃∃ a bijectiona bijection ff::VV11→→VV22 such thatsuch that ∀∀
aa,,bb∈∈VV11,, aa andand bb are adjacent inare adjacent in GG11 iffiff ff((aa) and) and
ff((bb) are adjacent in) are adjacent in GG22..
– ff is the “renaming” function that makes the twois the “renaming” function that makes the two
graphs identical.graphs identical.
– Definition can easily be extended to other typesDefinition can easily be extended to other types
of graphs.of graphs.
§ 9.3 – Graph Representations & Isomorphism
32
Graph Invariants under Isomorphism
NecessaryNecessary but notbut not sufficientsufficient conditions forconditions for
GG11=(=(VV11,, EE11) to be isomorphic to) to be isomorphic to GG22=(=(VV22,, EE22):):
– ||VV1|=|1|=|VV2|, |2|, |EE1|=|1|=|EE2|.2|.
– The number of vertices with degreeThe number of vertices with degree nn is theis the
same in both graphs.same in both graphs.
– For every proper subgraphFor every proper subgraph gg of one graph, thereof one graph, there
is a proper subgraph of the other graph that isis a proper subgraph of the other graph that is
isomorphic toisomorphic to gg..
§ 9.3 – Graph Representations & Isomorphism
33
Isomorphism Example
• If isomorphic, label the 2nd graph to showIf isomorphic, label the 2nd graph to show
the isomorphism, else identify difference.the isomorphism, else identify difference.
a
b
cd
e
f
b
d
a
e
fc
§ 9.3 – Graph Representations & Isomorphism
34
Are These Isomorphic?
• If isomorphic, label the 2nd graph to showIf isomorphic, label the 2nd graph to show
the isomorphism, else identify difference.the isomorphism, else identify difference.
a
b
c
d
e
* Same # of
vertices
* Same # of
edges
* Different
# of verts of
degree 2!
(1 vs 3)
§ 9.3 – Graph Representations & Isomorphism
35
§9.4: Connectivity
• In an undirected graph, aIn an undirected graph, a path of length npath of length n
from u to vfrom u to v is a sequence of adjacent edgesis a sequence of adjacent edges
going from vertexgoing from vertex uu to vertexto vertex vv..
• A path is aA path is a circuitcircuit ifif u=vu=v..
• A pathA path traversestraverses the vertices along it.the vertices along it.
• A path isA path is simplesimple ifif it contains no edge moreit contains no edge more
than oncethan once..
§ 9.4 – Connectivity
36
Paths in Directed Graphs
• Same as in undirected graphs, butSame as in undirected graphs, but the paththe path
must go in the directionmust go in the direction of the arrows.of the arrows.
§ 9.4 – Connectivity
37
Connectedness
• An undirected graph isAn undirected graph is connectedconnected iffiff there is athere is a
path between every pair of distinct vertices in thepath between every pair of distinct vertices in the
graphgraph..
• Theorem: There is aTheorem: There is a simplesimple path between any pairpath between any pair
of distinct vertices in a connected undirectedof distinct vertices in a connected undirected
graph.graph.
• Connected componentConnected component: connected subgraph: connected subgraph
• AA cut vertexcut vertex oror cut edgecut edge separates 1 connectedseparates 1 connected
component into 2 if removed.component into 2 if removed.
§ 9.4 – Connectivity
38
Directed Connectedness
• A directed graph isA directed graph is strongly connectedstrongly connected iffiff
there is a directed paththere is a directed path fromfrom aa toto bb and fromand from
bb toto aa for any two verticesfor any two vertices aa andand bb..
• It isIt is weakly connectedweakly connected iff the underlyingiff the underlying
undirectedundirected graph (graph (i.e.i.e., with edge directions, with edge directions
removed) is connected.removed) is connected.
• NoteNote stronglystrongly impliesimplies weaklyweakly but not vice-but not vice-
versa.versa.
§ 9.4 – Connectivity
39
Example
• Are the graphsAre the graphs GG andand HH stronglystrongly
connectedconnected?? Are theyAre they weakly connectedweakly connected??
a b
c
de
a b
c
de
G H
§ 9.4 – Connectivity
40
Paths & Isomorphism
• Note that connectedness, and the existenceNote that connectedness, and the existence
of a circuit orof a circuit or simple circuit of lengthsimple circuit of length kk areare
graph invariantsgraph invariants with respect towith respect to
isomorphismisomorphism..
a b
c
de
f
m n
o
pq
r
IsomorphicIsomorphic??
§ 9.4 – Connectivity
41
Counting Paths w Adjacency Matrices
• LetLet AA be the adjacency matrix of graphbe the adjacency matrix of graph GG..
• TheThe numbernumber of paths of lengthof paths of length rr fromfrom vvii toto vvjj
is equal tois equal to ((AArr
))i,ji,j. (The notation (. (The notation (MM))i,ji,j denotesdenotes
mmi,ji,j where [where [mmi,ji,j] =] = MM..))
§ 9.4 – Connectivity
42
Example
• How many paths of length 4 fromHow many paths of length 4 from aa toto dd??
a b
cd












=
0110
1001
1001
0110
A =4
A
§ 9.4 – Connectivity

More Related Content

What's hot (20)

Graph theory
Graph theoryGraph theory
Graph theory
 
Chapter 5 Graphs (1).ppt
Chapter 5 Graphs (1).pptChapter 5 Graphs (1).ppt
Chapter 5 Graphs (1).ppt
 
Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphs
 
Chapter 4 Integration
Chapter 4  IntegrationChapter 4  Integration
Chapter 4 Integration
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applications
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Matrix representation of graph
Matrix representation of graphMatrix representation of graph
Matrix representation of graph
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
lattice
 lattice lattice
lattice
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph Traversal Algorithm
Graph Traversal AlgorithmGraph Traversal Algorithm
Graph Traversal Algorithm
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Digital logic circuit
Digital logic circuitDigital logic circuit
Digital logic circuit
 
Function and Its Types.
Function and Its Types.Function and Its Types.
Function and Its Types.
 
AN APPLICATION OF Gd -METRIC SPACES AND METRIC DIMENSION OF GRAPHS
AN APPLICATION OF Gd -METRIC SPACES AND METRIC DIMENSION OF GRAPHSAN APPLICATION OF Gd -METRIC SPACES AND METRIC DIMENSION OF GRAPHS
AN APPLICATION OF Gd -METRIC SPACES AND METRIC DIMENSION OF GRAPHS
 
Graph terminologies & special type graphs
Graph terminologies & special type graphsGraph terminologies & special type graphs
Graph terminologies & special type graphs
 
Echelon forms
Echelon formsEchelon forms
Echelon forms
 
Graph theory
Graph theoryGraph theory
Graph theory
 

Similar to Graph theory

Graph theory concepts complex networks presents-rouhollah nabati
Graph theory concepts   complex networks presents-rouhollah nabatiGraph theory concepts   complex networks presents-rouhollah nabati
Graph theory concepts complex networks presents-rouhollah nabatinabati
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptxARVIND SARDAR
 
Elements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptxElements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptxmiki304759
 
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
 
Ass. (3)graph d.m
Ass. (3)graph d.mAss. (3)graph d.m
Ass. (3)graph d.mSyed Umair
 
Lecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxLecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxChandanGiri21
 
CAD Topology and Geometry Basics
CAD Topology and Geometry BasicsCAD Topology and Geometry Basics
CAD Topology and Geometry BasicsAndrey Dankevich
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theoryArvindBorge
 
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
 
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORKMETRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORKgraphhoc
 
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORKMETRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORKFransiskeran
 

Similar to Graph theory (20)

Graph
GraphGraph
Graph
 
Unit 2: All
Unit 2: AllUnit 2: All
Unit 2: All
 
graph ASS (1).ppt
graph ASS (1).pptgraph ASS (1).ppt
graph ASS (1).ppt
 
Graph theory concepts complex networks presents-rouhollah nabati
Graph theory concepts   complex networks presents-rouhollah nabatiGraph theory concepts   complex networks presents-rouhollah nabati
Graph theory concepts complex networks presents-rouhollah nabati
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptx
 
Elements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptxElements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptx
 
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
 
graph theory
graph theorygraph theory
graph theory
 
Ass. (3)graph d.m
Ass. (3)graph d.mAss. (3)graph d.m
Ass. (3)graph d.m
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Lecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxLecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptx
 
CAD Topology and Geometry Basics
CAD Topology and Geometry BasicsCAD Topology and Geometry Basics
CAD Topology and Geometry Basics
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theory
 
graphtheory
graphtheorygraphtheory
graphtheory
 
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.ppt
graph.pptgraph.ppt
graph.ppt
 
09_DS_MCA_Graphs.pdf
09_DS_MCA_Graphs.pdf09_DS_MCA_Graphs.pdf
09_DS_MCA_Graphs.pdf
 
LEC 1.pptx
LEC 1.pptxLEC 1.pptx
LEC 1.pptx
 
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORKMETRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
 
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORKMETRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
METRIC DIMENSION AND UNCERTAINTY OF TRAVERSING ROBOTS IN A NETWORK
 

More from Gaditek

Digital marketing strategy and planning | About Business
Digital marketing strategy and planning | About BusinessDigital marketing strategy and planning | About Business
Digital marketing strategy and planning | About BusinessGaditek
 
Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...Gaditek
 
Marketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of MarketingMarketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of MarketingGaditek
 
understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?Gaditek
 
The marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediariesThe marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediariesGaditek
 
strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build Gaditek
 
Digital marketing | what is marketing?
Digital marketing | what is marketing?Digital marketing | what is marketing?
Digital marketing | what is marketing?Gaditek
 
Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...Gaditek
 
Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2Gaditek
 
Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1Gaditek
 
Pipelining of Processors
Pipelining of ProcessorsPipelining of Processors
Pipelining of ProcessorsGaditek
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Gaditek
 
differential equation Lecture#14
differential equation  Lecture#14differential equation  Lecture#14
differential equation Lecture#14Gaditek
 
differential equation Lecture#12
differential equation Lecture#12differential equation Lecture#12
differential equation Lecture#12Gaditek
 
differential equation Lecture#11
differential equation Lecture#11differential equation Lecture#11
differential equation Lecture#11Gaditek
 
differential equation Lecture#13
differential equation Lecture#13differential equation Lecture#13
differential equation Lecture#13Gaditek
 
differential equation Lecture#10
differential equation Lecture#10differential equation Lecture#10
differential equation Lecture#10Gaditek
 
differential equation Lecture#9
differential equation  Lecture#9differential equation  Lecture#9
differential equation Lecture#9Gaditek
 
differential equation Lecture#8
differential equation Lecture#8differential equation Lecture#8
differential equation Lecture#8Gaditek
 
differential equation Lecture#7
differential equation Lecture#7differential equation Lecture#7
differential equation Lecture#7Gaditek
 

More from Gaditek (20)

Digital marketing strategy and planning | About Business
Digital marketing strategy and planning | About BusinessDigital marketing strategy and planning | About Business
Digital marketing strategy and planning | About Business
 
Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...
 
Marketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of MarketingMarketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of Marketing
 
understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?
 
The marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediariesThe marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediaries
 
strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build
 
Digital marketing | what is marketing?
Digital marketing | what is marketing?Digital marketing | what is marketing?
Digital marketing | what is marketing?
 
Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...
 
Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2
 
Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1
 
Pipelining of Processors
Pipelining of ProcessorsPipelining of Processors
Pipelining of Processors
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
 
differential equation Lecture#14
differential equation  Lecture#14differential equation  Lecture#14
differential equation Lecture#14
 
differential equation Lecture#12
differential equation Lecture#12differential equation Lecture#12
differential equation Lecture#12
 
differential equation Lecture#11
differential equation Lecture#11differential equation Lecture#11
differential equation Lecture#11
 
differential equation Lecture#13
differential equation Lecture#13differential equation Lecture#13
differential equation Lecture#13
 
differential equation Lecture#10
differential equation Lecture#10differential equation Lecture#10
differential equation Lecture#10
 
differential equation Lecture#9
differential equation  Lecture#9differential equation  Lecture#9
differential equation Lecture#9
 
differential equation Lecture#8
differential equation Lecture#8differential equation Lecture#8
differential equation Lecture#8
 
differential equation Lecture#7
differential equation Lecture#7differential equation Lecture#7
differential equation Lecture#7
 

Recently uploaded

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 

Recently uploaded (20)

9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 

Graph theory

  • 2. 2 §9.1: Graphs and Graph Models • Correspond to symmetricCorrespond to symmetric binary relationsbinary relations RR.. • AA simple graphsimple graph GG=(=(VV,,EE)) consists of:consists of: – a seta set VV ofof verticesvertices oror nodesnodes ((VV corresponds tocorresponds to the universe of the relationthe universe of the relation RR),), – a seta set EE ofof edgesedges // arcsarcs // linkslinks:: unordered pairsunordered pairs ofof [distinct?][distinct?] elementselements uu,,vv ∈∈ VV, such that, such that uRvuRv.. Visual Representation of a Simple Graph § 9.1 – Graphs and Graph Models
  • 3. 3 • LetLet VV be the set of states in the far-be the set of states in the far- southeastern U.S.:southeastern U.S.: –VV={FL, GA, AL, MS, LA, SC, TN, NC}={FL, GA, AL, MS, LA, SC, TN, NC} • LetLet EE={{={{uu,,vv}|}|uu adjoinsadjoins vv}} ={{FL,GA},{FL,AL},{FL,MS},={{FL,GA},{FL,AL},{FL,MS}, {FL,LA},{GA,AL},{AL,MS},{FL,LA},{GA,AL},{AL,MS}, {MS,LA},{GA,SC},{GA,TN},{MS,LA},{GA,SC},{GA,TN}, {SC,NC},{NC,TN},{MS,TN},{SC,NC},{NC,TN},{MS,TN}, {MS,AL}}{MS,AL}} Example of a Simple Graph TN ALMS LA SC GA FL NC § 9.1 – Graphs and Graph Models
  • 4. 4 Multigraphs • Like simple graphs, butLike simple graphs, but there may bethere may be moremore than onethan one edge connecting two given nodesedge connecting two given nodes.. • AA multigraphmultigraph GG=(=(VV,, EE,, ff ) consists of a set) consists of a set VV of vertices, a setof vertices, a set EE of edges (as primitiveof edges (as primitive objects), and a functionobjects), and a function ff::EE→→{{{{uu,,vv}|}|uu,,vv∈∈VV ∧∧ uu≠≠vv}.}. • E.g., nodes are cities, edgesE.g., nodes are cities, edges are segments of major highways.are segments of major highways. Parallel edges § 9.1 – Graphs and Graph Models
  • 5. 5 Pseudographs • Like a multigraph, butLike a multigraph, but edges connecting aedges connecting a node to itself are allowednode to itself are allowed.. • AA pseudographpseudograph GG=(=(VV,, EE,, ff ) where) where ff::EE→→{{{{uu,,vv}|}|uu,,vv∈∈VV}. Edge}. Edge ee∈∈EE is ais a looploop ifif ff((ee)={)={uu,,uu}={}={uu}}.. • E.g.E.g., nodes are campsites, nodes are campsites in a state park, edges arein a state park, edges are hiking trails through the woods.hiking trails through the woods. § 9.1 – Graphs and Graph Models loops
  • 6. 6 Directed Graphs • Correspond to arbitrary binary relationsCorrespond to arbitrary binary relations RR,, which need not be symmetric.which need not be symmetric. • AA directed graphdirected graph ((VV,,EE) consists of a set of) consists of a set of verticesvertices VV and a binary relationand a binary relation EE onon VV.. • E.g.E.g.:: VV = people,= people, EE={(={(xx,,yy) |) | xx lovesloves yy}} • ee=(=(uu,,vv) ,) ,uu,,vv∈∈VV § 9.1 – Graphs and Graph Models
  • 7. 7 Directed Multigraphs • Like directed graphs, but there may be moreLike directed graphs, but there may be more than one arc from a node to another.than one arc from a node to another. • AA directed multigraphdirected multigraph GG=(=(VV,, EE,, ff ) consists) consists of a setof a set VV of vertices, a setof vertices, a set EE of edges, and aof edges, and a functionfunction ff::EE→→VV××VV.. • E.g.,E.g., VV=web pages,=web pages, EE=hyperlinks.=hyperlinks. The WWW isThe WWW is a directed multigraph...a directed multigraph... § 9.1 – Graphs and Graph Models
  • 8. 8 Types of Graphs: Summary • Summary of the book’s definitions.Summary of the book’s definitions. • Keep in mind this terminology is not fullyKeep in mind this terminology is not fully standardized...standardized... Term Edge type Multiple edges ok? Self- loops ok? Simple graph Undir. No No Multigraph Undir. Yes No Pseudograph Undir. Yes Yes Directed graph Directed No Yes Directed multigraph Directed Yes Yes § 9.1 – Graphs and Graph Models
  • 9. 9 §9.2: Graph Terminology • Adjacent, connects, endpoints, degree,Adjacent, connects, endpoints, degree, initial, terminal, in-degree, out-degree,initial, terminal, in-degree, out-degree, complete, cycles, wheels, n-cubes, bipartite,complete, cycles, wheels, n-cubes, bipartite, subgraph, union.subgraph, union. § 9.2 – Graph Terminology
  • 10. 10 Adjacency LetLet GG be an undirected graph with edge setbe an undirected graph with edge set EE.. LetLet ee∈∈EE be (or map to) the pair {be (or map to) the pair {uu,,vv}. Then}. Then we say:we say: • uu,, vv areare adjacentadjacent // neighborsneighbors // connectedconnected.. • EdgeEdge ee isis incident withincident with verticesvertices uu andand vv.. • EdgeEdge ee connectsconnects uu andand vv.. • VerticesVertices uu andand vv areare endpointsendpoints of edgeof edge ee.. § 9.2 – Graph Terminology
  • 11. 11 Degree of a Vertex • LetLet GG be an undirected graph,be an undirected graph, vv∈∈VV a vertex.a vertex. • TheThe degreedegree ofof vv, deg(, deg(vv), is its number of), is its number of incident edges. (Except that any self-loopsincident edges. (Except that any self-loops are counted twice.)are counted twice.) • A vertex with degree 0 isA vertex with degree 0 is isolatedisolated.. • A vertex of degree 1 isA vertex of degree 1 is pendantpendant.. § 9.2 – Graph Terminology
  • 12. 12 Handshaking Theorem • LetLet GG be an undirected (simple, multi-, orbe an undirected (simple, multi-, or pseudo-) graph with vertex setpseudo-) graph with vertex set VV and edgeand edge setset EE. Then. Then • Corollary: Any undirected graph has anCorollary: Any undirected graph has an even number of vertices of odd degreeeven number of vertices of odd degree.. Ev Vv 2)deg( =∑∈ § 9.2 – Graph Terminology
  • 13. 13 Directed Adjacency • LetLet GG be a directed (possibly multi-) graph,be a directed (possibly multi-) graph, and letand let ee be an edge ofbe an edge of GG that is (or maps to)that is (or maps to) ((uu,,vv). Then we say:). Then we say: – uu isis adjacent toadjacent to vv,, vv isis adjacent fromadjacent from uu – ee comes fromcomes from uu,, ee goes togoes to vv.. – e connects u to ve connects u to v,, e goes from u to ve goes from u to v – thethe initial vertexinitial vertex ofof ee isis uu – thethe terminal vertexterminal vertex ofof ee isis vv § 9.2 – Graph Terminology
  • 14. 14 Directed Degree • LetLet GG be a directed graph,be a directed graph, vv a vertex ofa vertex of GG.. – TheThe in-degreein-degree ofof vv, deg, deg−− ((vv), is the number of), is the number of edges going toedges going to vv.. – TheThe out-degreeout-degree ofof vv, deg, deg++ ((vv), is the number of), is the number of edges coming fromedges coming from vv.. – TheThe degreedegree ofof vv, deg(, deg(vv))≡≡degdeg−− ((vv)+deg)+deg++ ((vv), is the), is the sum ofsum of vv’s in-degree and out-degree.’s in-degree and out-degree. § 9.2 – Graph Terminology
  • 15. 15 Directed Handshaking Theorem • LetLet GG be a directed (possibly multi-) graphbe a directed (possibly multi-) graph with vertex setwith vertex set VV and edge setand edge set EE. Then:. Then: • Note that the degree of a node is unchangedNote that the degree of a node is unchanged by whether we consider its edges to beby whether we consider its edges to be directed or undirected.directed or undirected. Evvv VvVvVv === ∑∑∑ ∈∈ + ∈ − )deg( 2 1 )(deg)(deg § 9.2 – Graph Terminology
  • 16. 16 Special Graph Structures Special cases of undirected graph structures:Special cases of undirected graph structures: • Complete graphsComplete graphs KKnn • CyclesCycles CCnn • WheelsWheels WWnn • nn-Cubes-Cubes QQnn • Bipartite graphsBipartite graphs • Complete bipartite graphsComplete bipartite graphs KKmm,,nn § 9.2 – Graph Terminology
  • 17. 17 Complete Graphs • For anyFor any nn∈∈NN, a, a complete graphcomplete graph onon nn vertices,vertices, KKnn, is a simple graph with, is a simple graph with nn nodesnodes in which every node is adjacent to everyin which every node is adjacent to every other node:other node: ∀∀uu,,vv∈∈VV:: uu≠≠vv↔↔{{uu,,vv}}∈∈EE.. Note that Kn has edges.2 )1(1 1 − =∑ − = nn i n i K1 K2 K3 K5 K6 K4 § 9.2 – Graph Terminology
  • 18. 18 Cycles • For anyFor any nn≥≥3, a3, a cyclecycle onon nn vertices,vertices, CCnn, is a, is a simple graph wheresimple graph where VV={={vv11,,vv22,… ,,… ,vvnn} and} and EE={{={{vv11,,vv22},{},{vv22,,vv33},…,{},…,{vvnn−−11,,vvnn},{},{vvnn,,vv11}}.}}. C3 C4 C5 C6 C7 C8 How many edges are there in Cn? § 9.2 – Graph Terminology
  • 19. 19 Wheels • For anyFor any nn≥≥3, a3, a wheelwheel WWnn, is a simple graph, is a simple graph obtained by taking the cycleobtained by taking the cycle CCnn and addingand adding one extra vertexone extra vertex vvhubhub andand nn extra edgesextra edges {{{{vvhubhub,,vv11}, {}, {vvhubhub,,vv22},…,{},…,{vvhubhub,,vvnn}}.}}. How many edges are there in Wn? W3 W5 W6 W7 W8 W4 § 9.2 – Graph Terminology
  • 20. 20 n-cubes (hypercubes) • For anyFor any nn∈∈NN, the hypercube, the hypercube QQnn is a simpleis a simple graph consisting of two copies ofgraph consisting of two copies of QQnn-1-1 connected together at corresponding nodes.connected together at corresponding nodes. QQ00 has 1 node.has 1 node. Q0 Q1 Q2 Q3 Q4 Number of vertices: 2n . Number of edges:Exercise to try! § 9.2 – Graph Terminology
  • 21. 21 n-cubes (hypercubes) • For anyFor any nn∈∈NN, the hypercube, the hypercube QQnn can becan be defined recursively as follows:defined recursively as follows: – QQ00={{={{vv00},},∅∅} (one node and no edges)} (one node and no edges) – For anyFor any nn∈∈NN, if Q, if Qnn==((VV,,EE), where), where VV={={vv11,…,,…,vvaa}} andand EE={={ee11,…,,…,eebb}, then}, then QQnn+1+1=(=(VV∪∪{{vv11´,…,´,…,vvaa´},´}, EE∪∪{{ee11´,…,´,…,eebb´}´}∪∪{{{{vv11,,vv11´},{´},{vv22,,vv22´},…,´},…, {{vvaa,,vvaa´}}) where´}}) where vv11´,…,´,…,vvaa´ are new vertices, and´ are new vertices, and where ifwhere if eeii={={vvjj,,vvkk} then} then eeii´={´={vvjj´,´,vvkk´}.´}. § 9.2 – Graph Terminology
  • 22. 22 Bipartite Graphs • AA simple graphsimple graph GG is calledis called bipartitebipartite if itsif its vertex setvertex set VV can be partitioned into twocan be partitioned into two disjoint setsdisjoint sets VV1 andand VV2 such thatsuch that every edgeevery edge in the graph connects a vertex inin the graph connects a vertex in VV1 and aand a vertex invertex in VV2(so that no edge in(so that no edge in GG connectsconnects either two vertices ineither two vertices in VV1 or two vertices inor two vertices in VV2)) § 9.2 – Graph Terminology
  • 23. 23 Complete Bipartite Graphs • TheThe complete bipartite graphcomplete bipartite graph KKm,n that has itsthat has its vertex set partitioned into two subsets ofvertex set partitioned into two subsets of mm andand nn vertices, respectively. There is anvertices, respectively. There is an edge between two verticesedge between two vertices iffiff one vertex isone vertex is in the first subset and the other is in thein the first subset and the other is in the second subsetsecond subset.. § 9.2 – Graph Terminology
  • 24. 24 Subgraphs • A subgraph of a graphA subgraph of a graph GG=(=(VV,,EE) is a graph) is a graph HH=(=(WW,,FF) where) where WW⊆⊆VV andand FF⊆⊆EE.. G H § 9.2 – Graph Terminology
  • 25. 25 Graph Unions • TheThe unionunion GG11∪∪GG22 of two simple graphsof two simple graphs GG11=(=(VV11,, EE11) and) and GG22=(=(VV22,,EE22) is the simple) is the simple graph (graph (VV11∪∪VV22,, EE11∪∪EE22).). § 9.2 – Graph Terminology
  • 26. 26 §9.3: Graph Representations & Isomorphism • Graph representations:Graph representations: – Adjacency lists.Adjacency lists. – Adjacency matrices.Adjacency matrices. – Incidence matrices.Incidence matrices. • Graph isomorphism:Graph isomorphism: – Two graphs are isomorphic iff they are identicalTwo graphs are isomorphic iff they are identical except for theirexcept for their node namesnode names.. § 9.3 – Graph Representations & Isomorphism
  • 27. 27 Adjacency Lists • A table with 1 row per vertex, listing itsA table with 1 row per vertex, listing its adjacent vertices.adjacent vertices. a b dc f e Vertex Adjacent Vertices a b c d e f § 9.3 – Graph Representations & Isomorphism
  • 28. 28 Directed Adjacency Lists • 1 row per node, listing the terminal nodes of1 row per node, listing the terminal nodes of each edge incident from that node.each edge incident from that node. § 9.3 – Graph Representations & Isomorphism a b dc f e Initial Vertex Terminal Vertices a b c d e f
  • 29. 29 Adjacency Matrices • MatrixMatrix AA=[=[aaijij], where], where aaijij isis 11 if {if {vvii,, vvjj} is an} is an edge ofedge of GG,, 00 otherwise.otherwise. a b c d             0001 0011 0101 1110 a b d c             0212 2110 1103 2030 § 9.3 – Graph Representations & Isomorphism
  • 30. 30 Incidence Matrices • MatrixMatrix AA=[=[aaijij]]vxe, where, where aaijij isis 11 ifif eejj incidentincident withwith vvii,, 00 otherwise.otherwise. b c d e                 011010 000101 110000 101100 000011a 1 23 4 5 6 § 9.3 – Graph Representations & Isomorphism
  • 31. 31 Graph Isomorphism • Formal definition:Formal definition: – Simple graphsSimple graphs GG11=(=(VV11,, EE11) and) and GG22=(=(VV22,, EE22) are) are isomorphicisomorphic iffiff ∃∃ a bijectiona bijection ff::VV11→→VV22 such thatsuch that ∀∀ aa,,bb∈∈VV11,, aa andand bb are adjacent inare adjacent in GG11 iffiff ff((aa) and) and ff((bb) are adjacent in) are adjacent in GG22.. – ff is the “renaming” function that makes the twois the “renaming” function that makes the two graphs identical.graphs identical. – Definition can easily be extended to other typesDefinition can easily be extended to other types of graphs.of graphs. § 9.3 – Graph Representations & Isomorphism
  • 32. 32 Graph Invariants under Isomorphism NecessaryNecessary but notbut not sufficientsufficient conditions forconditions for GG11=(=(VV11,, EE11) to be isomorphic to) to be isomorphic to GG22=(=(VV22,, EE22):): – ||VV1|=|1|=|VV2|, |2|, |EE1|=|1|=|EE2|.2|. – The number of vertices with degreeThe number of vertices with degree nn is theis the same in both graphs.same in both graphs. – For every proper subgraphFor every proper subgraph gg of one graph, thereof one graph, there is a proper subgraph of the other graph that isis a proper subgraph of the other graph that is isomorphic toisomorphic to gg.. § 9.3 – Graph Representations & Isomorphism
  • 33. 33 Isomorphism Example • If isomorphic, label the 2nd graph to showIf isomorphic, label the 2nd graph to show the isomorphism, else identify difference.the isomorphism, else identify difference. a b cd e f b d a e fc § 9.3 – Graph Representations & Isomorphism
  • 34. 34 Are These Isomorphic? • If isomorphic, label the 2nd graph to showIf isomorphic, label the 2nd graph to show the isomorphism, else identify difference.the isomorphism, else identify difference. a b c d e * Same # of vertices * Same # of edges * Different # of verts of degree 2! (1 vs 3) § 9.3 – Graph Representations & Isomorphism
  • 35. 35 §9.4: Connectivity • In an undirected graph, aIn an undirected graph, a path of length npath of length n from u to vfrom u to v is a sequence of adjacent edgesis a sequence of adjacent edges going from vertexgoing from vertex uu to vertexto vertex vv.. • A path is aA path is a circuitcircuit ifif u=vu=v.. • A pathA path traversestraverses the vertices along it.the vertices along it. • A path isA path is simplesimple ifif it contains no edge moreit contains no edge more than oncethan once.. § 9.4 – Connectivity
  • 36. 36 Paths in Directed Graphs • Same as in undirected graphs, butSame as in undirected graphs, but the paththe path must go in the directionmust go in the direction of the arrows.of the arrows. § 9.4 – Connectivity
  • 37. 37 Connectedness • An undirected graph isAn undirected graph is connectedconnected iffiff there is athere is a path between every pair of distinct vertices in thepath between every pair of distinct vertices in the graphgraph.. • Theorem: There is aTheorem: There is a simplesimple path between any pairpath between any pair of distinct vertices in a connected undirectedof distinct vertices in a connected undirected graph.graph. • Connected componentConnected component: connected subgraph: connected subgraph • AA cut vertexcut vertex oror cut edgecut edge separates 1 connectedseparates 1 connected component into 2 if removed.component into 2 if removed. § 9.4 – Connectivity
  • 38. 38 Directed Connectedness • A directed graph isA directed graph is strongly connectedstrongly connected iffiff there is a directed paththere is a directed path fromfrom aa toto bb and fromand from bb toto aa for any two verticesfor any two vertices aa andand bb.. • It isIt is weakly connectedweakly connected iff the underlyingiff the underlying undirectedundirected graph (graph (i.e.i.e., with edge directions, with edge directions removed) is connected.removed) is connected. • NoteNote stronglystrongly impliesimplies weaklyweakly but not vice-but not vice- versa.versa. § 9.4 – Connectivity
  • 39. 39 Example • Are the graphsAre the graphs GG andand HH stronglystrongly connectedconnected?? Are theyAre they weakly connectedweakly connected?? a b c de a b c de G H § 9.4 – Connectivity
  • 40. 40 Paths & Isomorphism • Note that connectedness, and the existenceNote that connectedness, and the existence of a circuit orof a circuit or simple circuit of lengthsimple circuit of length kk areare graph invariantsgraph invariants with respect towith respect to isomorphismisomorphism.. a b c de f m n o pq r IsomorphicIsomorphic?? § 9.4 – Connectivity
  • 41. 41 Counting Paths w Adjacency Matrices • LetLet AA be the adjacency matrix of graphbe the adjacency matrix of graph GG.. • TheThe numbernumber of paths of lengthof paths of length rr fromfrom vvii toto vvjj is equal tois equal to ((AArr ))i,ji,j. (The notation (. (The notation (MM))i,ji,j denotesdenotes mmi,ji,j where [where [mmi,ji,j] =] = MM..)) § 9.4 – Connectivity
  • 42. 42 Example • How many paths of length 4 fromHow many paths of length 4 from aa toto dd?? a b cd             = 0110 1001 1001 0110 A =4 A § 9.4 – Connectivity