Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Paths, Reachability and Connectedness

Dr. Mitesh S. Joshi.

March 14, 2022

1
Contents
1 Introduction 3
1.1 Paths, Simple and elementary paths . . . . . . . . . . . . . . . . 3
1.2 Cycles or circuits, simple and elementary cycles . . . . . . . . . . 4
1.3 Reachability of a vertex and a set . . . . . . . . . . . . . . . . . . 5
1.4 Connectedness of the graph . . . . . . . . . . . . . . . . . . . . . 6
1.5 Applications to represent resource allocation status of an operat-
ing system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.6 Detection and correction of deadlocks. . . . . . . . . . . . . . . . 9

2
1 Introduction

1.1 Paths, Simple and elementary paths


Definition 1.1. Any sequence of edges of a digraph such that the terminal node of
any edge in the sequence is the initial node of the edge, if any, appearing next in
the sequence defines a path of the graph.

Definition 1.2. A path is said to traverse through the nodes appearing in the
sequence, originating in the initial node of the first edge and ending in the terminal
node of the last edge in the sequence.

Definition 1.3. The number of edges appearing in the sequence of a path is called
the length of the path.

Figure 1: Digraph showing different paths

For a simple digraph in Figure-1, some paths originates in the node 1 and ending
in node 3 are given by,

P1 = {(1, 2), (2, 3)}


P2 = {(1, 4), (4, 3)}
P3 = {(1, 2), (2, 4), (4, 3)}
P4 = {(1, 2), (2, 4), (4, 1), (1, 2), (2, 3)}
P5 = {(1, 2), (2, 4), (4, 1), (1, 4), (4, 3)}
P6 = {(1, 1), (1, 1), . . . . . . , (1, 2), (2, 3)}

Definition 1.4. A path in a digraph in which the edges are all distinct is called a
simple path (edge-simple).

Definition 1.5. A path in which all the nodes through which it traverses are
distinct is called an elementary path (node simple).

3
Remarks:

1. Every elementary path of a digraph is a simple path. But every simple path
may not be elementary path.

2. Hence the paths P1 , P2 , P3 are all elementary paths, while P5 is a simple


path but not elementary path.

3. A digraph containing only one self loop(Sling) or only one parallel edges is
a simple path.

4. In a path any vertex appears twice as either initial vertex or a terminal vertex
then it is called an elementary path.

1.2 Cycles or circuits, simple and elementary cycles


Definition 1.6. A path which originates and ends in the same node is called a
cycle or circuit.

Definition 1.7. A cycle is called simple cycle if its path is simple that is no edge
in the cycle appears more than once in the path.

Definition 1.8. A cycle is called elementary cycle if it does not traverse through
any node more than once.

Definition 1.9. A simple digraph which does not have any cycle is called acyclic.

The following are some of the cycles in the above Figure-1.

C1 = {(1, 1)}
C2 = {(1, 2), (2, 1)}
C3 = {(1, 2), (2, 3), (3, 1)}
C4 = {(1, 4), (4, 3), (3, 1)}
C5 = {(1, 4), (4, 3), (3, 2), (2, 1)}

Remarks:

1. In a cycle the initial node appears at least twice even if it is an elementary


cycle. In other words self loop is simple as well as elementary cycle.

2. Self loop and parallel edges are considered as simple cycle.

3. In a cycle any vertex appears twice as either initial vertex or a terminal


vertex then it is called an elementary cycle.

4
1.3 Reachability of a vertex and a set
Definition 1.10. A node v of a simple digraph is said to be reachable or accessible
from the node u of the same digraph, if there exists a path from u to v.

Definition 1.11. If a node v is reachable from node u, then a path of minimum


length from u to v is called a geodesic.

Definition 1.12. The length of a geodesic from the node u to the node v is called
the distance and is denoted by d(u, v).

Remarks:

1. It is assumed that d(u, u) = 0 for any node u.

2. If the node v is not reachable from u then d(u, v) = ∞.

3. If v is reachable from u and u is reachable from v then d(u, v) is not neces-


sary equal to d(v, u).

Theorem 1.13. In a simple digraph, the length of any elementary path is less than
or equal to n − 1, where n is number of nodes in the graph. Similarly, the length
of any elementary cycle does not exceed n.

Proof. The proof may summarized as follows.

• We know that any node appearing in the elementary path is distinct.

• Since the number of distinct nodes in any elementary path of length k is


k + 1, the length of elementary path in a digraph with n distinct nodes is
less than or equal to (n − 1).

• Similarly, an elementary cycle of length k, the sequence contains k distinct


nodes the length of elementary cycle does not exceed n.

Definition 1.14. Consider a directed graph G = (V, E). The set of all nodes
which are reachable from a given node v is said to be reachable set of v. The
reachable set of v is written as R(v).

Definition 1.15. Consider a directed graph G = (V, E). For any subset S ⊆ V ,
the reachable set of the set S is the set of nodes which are reachable from any
node of S, and this set is denoted by R(S).

Definition 1.16. Consider a directed graph G = (V, E), a subset X ⊆ V is called


a node base if its reachable set is V and if no proper subset of X has this property.

The reachable-set of the node v1 , v2 , v3 , v4 and v5 is given by,

R(v1 ) = {v1 , v2 , v3 , v4 , v5 , v6 } (1)


= R(v2 ) = R(v2 ) = R(v3 ) = R(v4 ) = R(v5 )

5
(, (, ,( (, ,(
2( (2 (2 2( (2
,4 ,4 4, ,4 4,
, , , , ,
4 4 4 4 4
)1 1
) 1 ) 1
) 1 )
,) ,) ), ,) ),
(, ,( ,( ,( ,(
4( 4( (4 4( (4
,1 1
, 1 , 1
, 1,
, , , , ,
1 1 1 1 1
)2 )2 2) )2 2)
,) ), ), ), ),
(, ,( ,( (, ,(
Figure( 2: Reachable set (and Node base ( (1
1( 1 1 1
,2 2, 2, ,2 2,
, the reachable set, of other nodes v6 ,, v7 , v8 , v9 and v10, are given ,by,
Similarly,
2 2 2 2 2
)3 R(v6 ) = {v )3 6 } , R(v7 ) = {v6 ,3)v7 } , R(v9 ) = {v)39 } 3) (2)
,) R(v10 ) =), {v10 } , v8 = {v6 ,),v7 , v8 } ), ),
(\ (\ \( (\ \(
Finallly,2r the nodebase of ther2 graph G = (V, E) r2 is given by, r2 r2

R (v1 , v8 , v9 , v10 ) = V = R (v5 , v8 , v9 , v10 ) (3)

Remarks: From the above we make following observations.

1. Every isolated node lies in the node base.

2. Any node with in-degree zero lies in the node base.

3. No pair of nodes in the node base are reachable from one another.

4. Any node from the elementary cycle can be included in the node base.

5. Any node with non-zero in degree and that does not lie on any cycle can’t
be node of the node base.

6. In a acyclic graph node base contains a node with in-degree zero.

1.4 Connectedness of the graph


Definition 1.17. An undirected graph is said to be connected graph if for any
pair of nodes of the graph the two nodes are reachable from one another.

Definition 1.18. We say that a digraph is connected or weekly connected if it is


connected as an undirected graph in which the direction of the edges is neglected.

Definition 1.19. A simple digraph is said to be unilaterally connected if for any


pair of nodes of the graph at least one of the node of pair is reachable from the
other node.

Definition 1.20. If for any pair of nodes of the graph both the nodes of the pair
are reachable from one another, then the graph is called strongly connected.

6
Figure 3: Strongly connected, Weekly connected and not Unilaterally connected,
Unilaterally connected but not Strongly connected

Remarks:

1. A unilaterally connected digraph is weekly connected, but a weekly con-


nected digraph is not necessarily unilaterally connected.

2. In a weekly connected digraph we may find that for any pair of nodes say u
and v, neither u is reachable from v nor v is reachable from u.

3. A strongly connected digraphs is both unilaterally and weakly connected.

Definition 1.21. Let G = (V, E) be a simple digraph and X ⊆ V . A subgraph


whose nodes are given the set X and whose edges consist of all those edges of G
which have their initial and terminal nodes in X is called the subgraph generated
by X.

Definition 1.22. A subgraph G1 is said to be maximum with respect to some


property if no other subgraph has the property and also includes G1 .

Definition 1.23. For a simple digraph, a maximal strongly connected subgraph is


called strong component.

Definition 1.24. Similarly, a maximal unilaterally connected or maximal weakly


connected subgraph is called a unilateral or weak component respectively.

Figure 4: Component of the digraph

7
Remarks:

1. The subsets {1, 2, 3} , {4} , {5} and {6} are strong components.
2. The subsets {1, 2, 3, 4, 5} and {6} are unilateral component.
3. The set {1, 2, 3, 4, 5, 6} is weakly component.
Theorem 1.25. In a simple graph G = (V, E), every node of the digraph lies in
exactly one strong component.

Proof. Let v ∈ V and S = R(v) ⊂ V be the set of all those of nodes of G which
are mutually reachable with v. Hence the set S naturally contains v and is a strong
component. This shows that every node of G is contained in a strong component.

Assume that the node v lies in two components W = R(v) and Z = R(v).
Then every node in W through v is reachable to every node in Z. Which is not
possible. Hence every node lies one strong component.

Similar kinds of result can be stated for weak component and unilateral compo-
nent.
Corollary 1.26. Every node and edge of a simple digraph contained in exactly
one weak component.
Corollary 1.27. Every node and edge of a simple digraph contained in exactly
one unilateral component.

1.5 Applications to represent resource allocation status of an


operating system.
In a multiprogrammed computer system, it appears that several programs are ex-
ecuted at one time. In reality the programs are sharing the resources of the com-
puter system, such asunits, disc devices, the central processor, main memory and
compilers. A special set of programs called an operating system controls the al-
location of these resources, it issue a request for that resource, and the operating
system must ensure that the request is satisfied.
Definition 1.28. Sometime the request for resources are in conflict. For example,
program A may have control of the resource r1 and require resource r2 , but pro-
gram B has control of resource r2 and require resource r1 . In This situation, the
computer system is said to be in a state known as deadlock.

A directed graph can be used to model resource requests and assist in the detection
and correction of deadlocks.

• It is assumed that all resource requests of a programs must be satisfied be-


fore that program can complete execution.
• If any request resources are unavailable at the time of the request, the pro-
gram will assure control of the resources available, but must wait for the
unavailable resources.

8
1.6 Detection and correction of deadlocks.
Let Pt = {p1 , p2 , . . . . . . , pm } represents the set program in the computer system
at time t. Let Ai ⊆ Pt be the set of active programs, or programs that have
been allocated at least a portion of their resource requests at time t. Finally, let
Rt = {r1 , r2 , . . . . . . , rn } represent the set of resources in the system at time t.
An allocation graph Gt is a directed graph representing the resource allocation
status of the systme at time t and consisting of a set of nodes V = Rt and a set of
edges E. Each resources is represented by a node of the directed graph. There
is a directed edge from node ri to rj if and only if there is a program pk in At that
has been allocated resource ri but is waiting for rj .

Problem 1.29. Let Rt = {r1 , r2 , r3 , r4 }, Pt = {p1 , p2 , p3 , p4 } and the resource


allocation status be,

p1 has resource r4 and requires r1


p2 has resource r1 and requires r2 and r3
p3 has resource r2 and requires r3
p4 has resource r3 and requires r1 and r4 .

Then give the allocation graph at time t.

Solution 1.30. It can be shown that the state of deadlock exists in a computer
system at time t if and only if the allocation digraph Gt contains the strongly
connected components. In the case of our example. the graph Gt is strongly
connected.

Figure 5: Allocation digraph for detecting deadlocks.

References
[1] Engineering Mathematics Vol.-I and II. A.P Verma and M. N. Mehta. Stu-
dent manual SVNIT, Surat.

9
[2] Erwin Kreyszig: Advanced Engineering Mathematics, 8th edition, John
Wiley and Sons, (2008).

[3] George B. Thomas, Jr. Ross L. Finley: Calculus with analytical Geometry,
9th edition Addison-Wesley Publishing Company. (2004)

[4] Howard Anton: Calculus, A new horizon, 6th edition, John Willey and
Sons, (2006)

[5] Michael D. Greenberg. Advanced Engineering Mathematics. Prentice-Hall


International, Inc. NJ.

Acknowledgment
I am very much thankful to Prof. P. A. Gajjar, Head of the department, Nottingham
university, Kazakhstan for his valuable guidance for the preparation of this topic.

10

You might also like