graph-theory
graph-theory
Theory
DISCRETE
M AT H E M AT I C S
( C S 11 4 2 )
Prepared by
Dr. Manushi Gupta
Introduction
The subject of graph theory began in the year 1736 when the great mathematician Leonhard Euler published a
paper giving the solution to the following puzzle:
The town of Königsberg in Prussia (now Kaliningrad in Russia) was built at a point where two branches of the
Pregel River came together. It consisted of an island and some land along the riverbanks. These were connected
by seven bridges as shown in the figure. The question is this: Is it possible for a person to take a walk around
town, starting and ending at the same location and crossing each of the seven bridges exactly once?
Any 𝑥 − 𝑦 walk where 𝑥 = 𝑦 (and 𝑛 > 1) is called a 𝐜𝐥𝐨𝐬𝐞𝐝 𝐰𝐚𝐥𝐤. Otherwise, the walk is called open.
A trail from 𝒙 to 𝒚 is a walk from 𝒙 to 𝒚 that does not contain a repeated edge.
A circuit is a closed walk that contains at least one edge and does not contain a repeated edge.
A simple circuit (cycle) is a circuit that does not have any other repeated vertex except the first and last.
Path No No No No
A graph is said to be a subgraph of a graph if, and only if, every vertex in is also a vertex in
, every edge in is also an edge in , and every edge in has the same endpoints as it has in .
List all subgraphs of the graph G with vertex set {𝑣 , 𝑣 } and edge set {𝑒 , 𝑒 , 𝑒 }, where the endpoints of 𝑒 are 𝑣 and 𝑣 , the
endpoints of 𝑒 are 𝑣 and 𝑣 , and 𝑒 is a loop at 𝑣 . Find the degree of each vertex.
Draw and
Let 𝐺 = (𝑉, 𝐸) be a directed graph. Its associated undirected graph is the graph obtained from G by ignoring the
directions on the edges. If more than one undirected edge results for a pair of distinct vertices in G, then only one of
these edges is drawn in the associated undirected graph. When this associated graph is connected, we consider G
connected.
2. H is connected; and
3. no connected subgraph of G has H as a subgraph and contains vertices or edges that are in H.
This definition explains the concept of graph isomorphism, which is a way to determine if
two graphs have the same structure, regardless of how they are drawn or labeled.
What all
isomorphism Adjacencies Path Cycle
preserves?
Dr. Manushi Gupta
Simple Graphs: A simple graph is a loop-free graph that does not contain more than one edge between the
pair of vertices.
Multigraph: The pair (𝑉, 𝐸) determines a multigraph 𝐺 with vertex set V and edge set 𝐸 if, for some 𝑥, 𝑦 ∈
𝑉, there are two or more edges in 𝐸.
𝑎 → 𝑞, 𝑐 → 𝑢, 𝑒 → 𝑟, 𝑔 → 𝑥, 𝑖 → 𝑧,
𝑏 → 𝑣, 𝑑 → 𝑦, 𝑓 → 𝑤, ℎ → 𝑡, 𝑗 → 𝑠
gives an isomorphism.
Corollary: For any undirected graph or multigraph, the number of vertices of odd
degree must be even.
Is it possible to have a 4-
regular graph with 10 edges?
Is it possible to have a 4-
regular graph with 15 edges?
Corollary: If G is an undirected graph or multigraph with no isolated vertices, then we can construct
an Euler trail in G if and only if G is connected and has exactly two vertices of odd degree.
n odd, n=2
a) The incoming, or in, degree of 𝑣 is the number of edges in 𝐺 that are incident into v, and this is denoted by 𝒊𝒅(𝒗).
b) The outgoing, or out, degree of v is the number of edges in 𝐺 that are incident from v, and this is denoted by 𝒐𝒅(𝒗).
For the case where the directed graph or multigraph contains one or more loops, each loop at a given vertex v contributes a count
of 1 to each of 𝑖𝑑(𝑣) and 𝑜𝑑(𝑣).
Note that for Eulerian, we use trail and circuit as we don’t to repeat the edge but
for Hamiltonian, we use path and cycle (simple circuit) as we want to cover every
vertex just once.
In a complete graph with 𝑛 vertices, each vertex is connected to every other vertex by an edge. Starting at
any vertex there are 𝑛 − 1 possible choices of vertices to visit next. After that, there are 𝑛 − 2 vertices left
to visit, and so on. Since every vertex is connected to every other vertex, this means there are 𝑛! = 𝑛 ×
(𝑛 − 1) × (𝑛 − 2) × ⋯ × 2 × 1 possible Hamiltonian cycles.
Let us know reduce the repetition. First, each of the cycle is counted 𝑛 times: once for each possible starting
point. So, we have to divide by n to get 𝑛!/𝑛, or (𝑛 − 1)!. Then we have still over-counted, because each cycle
has been counted in both directions (think clockwise and counter-clockwise), so we have to divide by 2,
eventually arriving at (𝒏 − 𝟏)!/𝟐.
Let be a directed graph with ordered vertices . The adjacency matrix of is the
matrix over the set of nonnegative integers such that
the number of arrows from
Let G be an undirected graph with ordered vertices . The adjacency matrix of is the
matrix over the set of nonnegative integers such that
the number of edges connecting
Find the adjacency matrices for the following directed Find adjacency matrices for the following (undirected)
graphs. graphs.
where each Ai is the 𝑛 × 𝑛 adjacency matrix of Gi, for every i = 1, 2, . . . , k, and the O’s represent matrices
whose entries are all 0.
𝒏
the number of walks of length from