MODULE1:
Introduction to Graphs
1.1Introduction:
Definition: A linear† graph (or simply a graph) G = (V, E) consists of a set of objects V = {v1
v2 , . . .} called vertices, and another set E = {e1’ e2 ,. . .}, whose elements are called edges,
such that each edge ek is identified with an unordered pair (vi , vj ) of vertices
The vertices vi vj associated with edge ek are called the end vertices of ek.
Fig:1.1 Graph with 5 vertices and seven edges
• Edge having the same vertex as both its end vertices is called a self-loop (or simply a
loop)
• More than one edge associated with a given pair of vertices are referred to as parallel
edges..(eg.e4 and e5)
• A graph that has neither self-loops nor parallel edges is called a simple graph.
• A graph is also called a linear complex, a 1-complex, or a one-dimensional.
• A vertex is also referred to as a node, a junction, a point, 0-cell, or an 0-simplex.
• Other terms used for an edge are a branch, a line, an element, a 1-cell, an arc, and a 1-
simplex.
1.2Applications of Graphs
• Königsberg Bridge Problem: The Königsberg bridge problem is perhaps the best-
known example in graph theory.
Fig 1.2 Fig 1.3
Two islands, C and D, formed by the Pregel River in Königsberg (then the
capital of East Prussia but now renamed Kaliningrad and in West Soviet Russia) were
connected to each other and to the banks A and B with seven bridges, as shown in Fig. 1.2 The
problem was to start at any of the four land areas of the city, A, B, C, or D, walk over each of
the seven bridges exactly once, and return to the starting point. Euler represented this situation
by means of a graph, as shown in Fig. 1.3
Utilities Problem: There are three houses (Fig. 1) H1 , H2 , and H3 , each to be connected to
each of the three utilities—water (W), gas (G), and electricity (E)— by means of conduits in
fig 1.4. Is it possible to make such connections without any crossovers of the conduits?
Fig 1.4 Fig 1.5
Figure 1.5 shows how this problem can be represented by a graph—the conduits are shown as
edges while the houses and utility supply centers are vertices. The graph in Fig. 1.5 cannot be
drawn in the plane without edges crossing over. Thus the answer to the problem is no.
Electrical Network Problems: Properties (such as transfer function and input impedance) of
an electrical network are functions of only two factors:
1. The nature and value of the elements forming the network, such as resistors, inductors,
transistors, and so forth.
2. The topology of a network is studied by means of its graph.
In drawing a graph of an electrical network(fig 1.6) the junctions are represented by vertices,
and branches (which consist of electrical elements) are represented by edges, regardless of the
nature and size of the electrical elements as shown in fig 1.7
.
Fig 1.6 Fig 1.7
Seating Problem: Nine members of a new club meet each day for lunch at a round table. They
decide to sit such that every member has different neighbours at each lunch. How many days
can this arrangement last? This situation can be represented by a graph with nine vertices such
that each vertex represents a member, and an edge joining two vertices represents the
relationship of sitting next to each other. Figure 1.8 shows two possible seating arrangements—
these are 1 2 3 4 5 6 7 8 9 1 (solid lines), and 1 3 5 2 7 4 9 6 8 1 (dashed lines). It can be shown
by graph-theoretic considerations that there are only two more arrangements possible. They are
1573928461 and 1 7 9 5 8 3 6 2 4 1. In general it can be shown that for n people the number of
such possible arrangements is
Fig 1.8
and
1-3. Finite and infinite graphs
A graph with a finite number of vertices as well as a finite number of edges is called a finite
graph.It is shown in fig 1.9
Fig 1.9
otherwise, it is an infinite graph Portions of two infinite graphs are shown in Fig 1.10
Fig 1.10
1.4 Bipartite graph:
A bipartite graph is a type of graph where the vertices can be divided into two distinct sets
such that no two vertices within the same set are adjacent. This means that every edge in the
graph connects a vertex from one set to a vertex in the other set
Fig 1.11
1.5Incidence and degree:
Fig 1.12
When a vertex vi is an end vertex of some edge ej , vi and ej are said to be incident with (on
or to) each other. In Fig. 1.12, for example, edges e2 , e6 , and e7 are incident with vertex v4 .
Two nonparallel edges are said to be adjacent if they are incident on a common vertex. For
example, e2 and e7 in Fig. 1.12 are adjacent.
The number of edges incident on a vertex vi , with self-loops counted twice, is called the
degree, d(vi ) of vertex vi .
In Fig. 1.12, for example, d(v1 ) = d(v3 ) = d(v4 ) = 3, d(v2 ) = 4, and d(v5 ) = 1. The degree
of a vertex is sometimes also referred to as its valency.
Since each edge contributes two degrees, the sum of the degrees of all vertices in G is twice
the number of edges in G. That is,
In the above graph d(v1 ) + d( v2 ) + d(v3 ) + d(v4 ) + d(v5 ) = 3 + 4 + 3 + 3+1 = 14 = twice
the number of edges.
THEOREM 1-1 The number of vertices of odd degree in a graph is always even.
Proof: If we consider the vertices with odd and even degrees separately, the quantity in the left
side of Eq. (1-1) can be expressed as the sum of two sums, each taken over vertices of even
and odd degrees, respectively, as follows:
Since the left-hand side in Eq. (1-2) is even, and the first expression on the right-hand side is
even (being a sum of even numbers), the second expression must
Because in Eq. (1-3) each d(vk ) is odd, the total number of terms in the sum must be even to
make the sum an even number. Hence the theorem.
A graph in which all vertices are of equal degree is called a regular graph
1.6 Isolated vertex, Pendent Vertex, Null graph
Isolated vertex
A vertex having no incident edge is called an isolated vertex. In other words, isolated vertices
are vertices with zero degree. Ex v4 and v7 in fig 1.13
Fig 1.13
Pendant vertex:
A vertex of degree one is called a pendant vertex or an end vertex. Ex. V3
Null graph
A null graph is a graph with no edges and only vertices. every vertex in a null graph is an
isolated vertex. Example:
Fig 1.14
1.7 PATHS AND CIRCUITS:
ISOMORPHISM:
In geometry two figures are thought of as equivalent (and called congruent) if they have
identical behavior in terms of geometric properties. Likewise, two graphs are thought of as
equivalent (and called isomorphic) if they have identical behavior in terms of graph-theoretic
properties
In other words, suppose that edge e is incident on vertices v1 and v2 in G; then the
corresponding edge e′ in G′ must be incident on the vertices v′1 and v′2 that correspond to v1
and v2 , respectively
Fig 1.15 Fig 1.16
The vertices a, b, c, d, and e in Fig 1.15 correspond to v1 , v2 , v3 , v4 , and v5 in Fig 1.16,
respectively. The edges 1, 2, 3, 4, 5, and 6 correspond to e1 , e2 , e3 , e4 , e5 , and e6 ,
respectively.
Fig 1.17 Fig 1.18
Isomorphic graphs are the same graph, perhaps drawn differently.
Isomorphic graphs must have:
1. The same number of vertices.
2. The same number of edges.
3. An equal number of vertices with a given degree.
• Graphs that are not Isomorphic are shown below
Fig 1.19 Fig 1.20
SUBGRAPHS
A graph g is said to be a subgraph of a graph G if all the vertices and all the edges of g are in
G, and each edge of g has the same end vertices in g as in G. g ⊂ G, is used in stating “g is a
subgraph of G.”
Fig 1.21 Fig 1.22
1. Every graph is its own subgraph.
2. A subgraph of a subgraph of G is a subgraph of G.
3. A single vertex in a graph G is a subgraph of G.
4. A single edge in G, together with its end vertices, is also a subgraph of g
Edge-Disjoint Subgraphs:
Two (or more) subgraphs g1 and g2 of a graph G are said to be edge disjoint if g1 and g2 do
not have any edges in common.
Fig 1.23 Graph K
Fig 1.24 Sub graph k1 Fig 1.25 Sub graph k2
1.8 WALKS, PATHS, AND CIRCUITS
Walk
• A walk is defined as a finite alternating sequence of vertices and edges, beginning and
ending with vertices, such that each edge is incident with the vertices preceding and
following it.
• No edge appears (is covered or traversed) more than once in a walk. A vertex, however,
may appear more than once
Fig 1.26 Fig 1.27
• v1 a v2 b v3 c v3 d v4 e v2 f v5 is a walk shown with heavy lines in fig (a)1.26.
• A walk is also referred to as an edge train or a chain.
• Vertices with which a walk begins and ends are called its terminal vertices. Vertices
v1 and v5 are the terminal vertices of the walk
• Closed walk-Walk which begins and end with same vertex.
• A walk that is not closed (i.e., the terminal vertices are distinct) is called an Open walk
Path
• An open walk in which no vertex appears more than once is called a path(simple
path/elementary path)
• vl a v2 b v3 d v4 is a path in fig 1.27
• The number of edges in a path is called the length of a path.
• The terminal vertices of a path are of degree one, and the rest of the vertices (called
intermediate vertices) are of degree two.
Circuit
• A closed walk in which no vertex (except the initial and the final vertex) appears more
than once is called a circuit.
Fig 1.28
• A circuit is also called a cycle, elementary cycle, circular path, and polygon
1.9 CONNECTED GRAPHS, DISCONNECTED
GRAPHS, AND COMPONENTS
A graph is connected if we can reach any vertex from any other vertex by traveling along the
edges.
Fig1.29: Connected graph Fig1.30: Disconnected graph
Disconnected graph consists of two or more connected graphs. Each of these connected
subgraphs is called a component.
THEOREM 2-1 A graph G is disconnected if and only if its vertex set V can be
partitioned into two nonempty, disjoint subsets V1 and V2 such that there exists no edge
in G whose one end vertex is in subset V1 and the other in subset V2 .
Proof: Suppose that such a partitioning exists. Consider two arbitrary vertices a and b of G,
such that a ∈ V1 and b ∈ V2 . No path can exist between vertices a and b; otherwise, there
would be at least one edge whose one end vertex would be in V1 and the other in V2 . Hence,
if a partition exists, G is not connected.
Conversely, let G be a disconnected graph. Consider a vertex a in G.
Let V1 be the set of all vertices that are joined by paths to a. Since G is disconnected, V1 does
not include all vertices of G.
Let V2 = V – V1 then V1 ∩ V2 = ϕ and V1 U V2 = V
The remaining vertices will form a (nonempty) set V2 . No vertex in V1 is joined to any in V2
by an edge. Hence the partition
THEOREM 2-2 :If a graph (connected or disconnected) has exactly two
vertices of odd degree, there must be a path joining these two vertices.
Proof: Let G be a graph with all even vertices† except vertices v1 and v2 , which are odd. From
Theorem 1-1, which holds for every graph and therefore for every component of a disconnected
graph, no graph can have an odd number of odd vertices. Therefore, in graph G, v1 and v2 must
belong to the same
THEOREM2-3:Show that the maximum number of edges in a simple graph
with 𝑛 vertices is 𝑛(𝑛 – 1)/2
We have that is a simple graph, no parallel or loop exist. Therefore the degree of each vertex
will be one less than the total number of vertices (at most). ie, degree=n-1
eg. If we have a graph with two vertices (so one edge) then degree=(n-1).
i.e (n-1)=(2-1)=1
We know that the sum of the degree in a simple graph always even
ie, ∑d(v)=2E
We know that degree one vertex is d(v)=n-1 :
Then for n vertices the total degree is n(n-1)
Therefore n(n-1)=2E
E=n(n−1)/2.Hence the proof
THEOREM 2-3 A simple graph (i.e., a graph without parallel edges or self-
loops) with n vertices and k components can have at most (n − k)(n − k + l)/2 edges.
Proof: Let the number of vertices in each of the k components of a graph G be n1 , n2 , . . . , nk . Thus
we have n1 + n2 + . . . + nk = n, ni ≥ 1.
The proof of the theorem depends on an algebraic inequality†
Now the maximum number of edges in the ith component of G is 𝑛i(𝑛i – 1)/2
Therefore, the maximum number of edges in G is
Hence the proof
Extra Questions
2)