0% found this document useful (0 votes)
12 views16 pages

Path Length

This paper explores network analysis through the path length matrix, which provides insights into communication properties of a graph represented by its adjacency matrix. It introduces new measures like harmonic K-centrality and global K-efficiency, and discusses the sensitivity of these measures to changes in the adjacency matrix. The study highlights the importance of the path length matrix in determining shortest paths and enhancing communication in networks, with applications in urban planning and disease propagation.

Uploaded by

iom939639
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views16 pages

Path Length

This paper explores network analysis through the path length matrix, which provides insights into communication properties of a graph represented by its adjacency matrix. It introduces new measures like harmonic K-centrality and global K-efficiency, and discusses the sensitivity of these measures to changes in the adjacency matrix. The study highlights the importance of the path length matrix in determining shortest paths and enhancing communication in networks, with applications in urban planning and disease propagation.

Uploaded by

iom939639
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Noname manuscript No.

(will be inserted by the editor)

Network analysis with the aid of the path length matrix

Silvia Noschese · Lothar Reichel

Abstract Let a network be represented by a simple graph G with n vertices. A common approach to
investigate properties of a network is to use the adjacency matrix A = [aij ]ni,j=1 ∈ Rn×n associated
with the graph G, where aij > 0 if there is an edge pointing from vertex vi to vertex vj , and aij = 0
otherwise. Both A and its positive integer powers reveal important properties of the graph. This paper
proposes to study properties of a graph G by also using the path length matrix for the graph. The (ij)th
entry of the path length matrix is the length of the shortest path from vertex vi to vertex vj ; if there
is no path between these vertices, then the value of the entry is ∞. Powers of the path length matrix
are formed by using min-plus matrix multiplication and are important for exhibiting properties of G. We
show how several known measures of communication such as closeness centrality, harmonic centrality, and
eccentricity are related to the path length matrix, and we introduce new measures of communication,
such as the harmonic K-centrality and global K-efficiency, where only (short) paths made up of at most
K edges are taken into account. The sensitivity of the global K-efficiency to changes of the entries of the
adjacency matrix also is considered.

Keywords network analysis, path length matrix, harmonic centrality, global efficiency

Mathematics Subject Classification (2000) 05C50, 15A16, 65F15

1 Introduction

An important characteristic of a network is how well communication can flow in it, i.e., how easy or
difficult it is to reach one part of the network from another part by following edges. How well information
flows through the whole network can be measured by the diameter of the graph that represents the
network or by its global efficiency. Both these measures can be determined with the aid of the path length
matrix associated with the network. We will discuss these connections and introduce new measures of
communication based on the path length matrix.
Let us introduce some notation and definitions that will be used throughout this paper. A network
is represented by a graph. A weighted graph G = hV, E, Wi consists of a set of nodes or vertices V =
{v1 , v2 , . . . , vn }, a set of edges E = {e1 , e2 , . . . , em } that connect the vertices, and a set of weights W =
Silvia Noschese
Dipartimento di Matematica
SAPIENZA Università di Roma
P.le Aldo Moro 5, 00185 Roma, Italy
E-mail: [email protected]
Lothar Reichel
Department of Mathematical Sciences
Kent State University
Kent, OH 44242, USA
E-mail: [email protected]
2 Silvia Noschese, Lothar Reichel

{aij }ni,j=1 ; the weights aij are the entries of the adjacency matrix A = [aij ]ni,j=1 associated with the graph
G; see below. An edge is said to be directed if it starts at a vertex vi and ends at a vertex vj , and is denoted
by e(vi → vj ). An edge between the vertices vi and vj is said to be undirected when the pair of vertices is
unordered and the weights aij and aji are positive and equal. An undirected egde between the vertices vi
and vj is denoted by e(vi ↔ vj ). A graph with only undirected edges is said to be undirected ; otherwise
the graph is directed. A simple graph is a graph without multiple edges or self-loops. In particular, this
implies that the diagonal entries of the adjacency matrix for the graph vanish. This work considers simple
graphs.
The adjacency matrix A = [aij ]ni,j=1 ∈ Rn×n for a weighted graph G is determined by the weights aij of
the graph with aij > 0 if there is an edge e(vi → vj ) in G. If there is no edge e(vi → vj ) in G, then aij = 0.
For an unweighted graph, all positive entries aij of A equal one. A sequence of k edges (not necessarily
distinct) such that {e(v1 → v2 ), e(v2 → v3 ), . . . , e(vk → vk+1 )} form a walk. If vk+1 = v1 , then the walk
is said to be closed. A sequence of distinct edges such that {e(v1 → v2 ), e(v2 → v3 ), . . . , e(vk → vk+1 )}
form a path. The length of a path is given by the sum of all weights of the edges in the path. (In the
unweighted case, the sum of all weights of the edges in a path of length k is k.) For further discussions
on networks and graphs; see [8, 14].
To construct the path length matrix associated with the network, we will make use of min-plus matrix
multiplication, i.e., matrix multiplication in the tropical algebra [12]:

C = [cij ]ni,j=1 = A ? B : cij = min {aih + bhj }, 1 ≤ i, j ≤ n,


h=1,2,...,n

(1,?)
where A, B, C ∈ Rn×n . We denote by A1,? = [aij ]ni,j=1 ∈ Rn×n the matrix obtained by setting to ∞ the
vanishing off-diagonal entries of the adjacency matrix A associated with the graph G under consideration.
For k > 1, the k th min-plus power of A1,? is given by
(k,?) n (k,?) (k−1,?) (1,?)
Ak,? = [aij ]i,j=1 ∈ Rn×n : aij = min {aih + ahj }.
h=1,2,...,n

Notice that the matrix Ak,? gives vertex distances using paths of at most k edges. In detail, the entry
(k,?)
aij , with i 6= j, represents the length of the shortest path from vi to vj made up of at most k edges.
(k,?)
The diagonal entries of Ak,? are zero by definition. One has aij = ∞ if every path from vi to vj is
made up of more than k edges, or if there is no path from vi to vj .
The diameter of a graph G is the maximal length dG of the shortest path between any distinct vertices
of the graph and provides a measure of how easy it is for the vertices of the graph to communicate. One
has
(n−1,?)
dG = max aij . (1)
1≤i,j≤n

(n−1,?) (n−1,?)
Indeed, the entry aij of the matrix An−1,? = [aij ]ni,j=1 yields the length of the shortest path
n−1,?
from vi to vj . We will refer to A as the path length matrix. Note that the triangle inequality holds
for the entries of a path length matrix. Specifically,
(n−1,?) (n−1,?) (n−1,?)
aij ≤ aih + ahj , 1 ≤ i, j ≤ n.

Consider an unweighted connected graph G with associated adjacency matrix A ∈ Rn×n . Recall that
the diameter of G is the maximal number of edges in the shortest path between all pairs of distinct
k, 1 ≤ b
vertices of the graph. Given the vertices vi and vj , there is an integer b k < n, such that

(n−1,?) (b
k+1,?) (b
k,?)
aij = · · · = aij = aij =b
k

(h,?)
since the graph is connected, whereas for 1 ≤ h < b
k, one has aij = ∞. Thus, information provided by
the path length matrix An−1,? includes information about all powers Ak,? for 1 ≤ k < n − 1.
Network analysis with the aid of the path length matrix 3

k, 1 ≤ b
Let vi and vj be distinct vertices in a weighted graph. Then there is an integer b k < n − 1, such
that
(n−1,?) (b
k+1,?) (b
k,?)
aij ≤ · · · ≤ aij ≤ aij < ∞
(h,?)
and, for 1 ≤ h < bk, aij = ∞. Thus, as in the unweighted case, information provided by the path length
n−1,?
matrix A refines information given by the powers Ak,? for 1 ≤ k < n − 1. However, the information
of the minimal number of steps required to reach vertex vj from vertex vi is lost.
As mentioned above, the path length matrix may be constructed by evaluating the min-plus powers of
A n − 2 times; here A1,? is obtained from the adjacency matrix A by setting all zero off-diagonal entries
1,?

to ∞. The following MATLAB function, with the adjacency matrix A for a graph and the level = n − 1 as
input arguments, returns the path length matrix associated with the adjacency matrix A. The function
implements the dynamic programming Bellmann-Ford algorithm for solving the well-known “all-pairs
shortest path problem”. The algorithm requires O(n2 m) arithmetic floating point operations (flops),
where n is the number of vertices and m is the number of edges of the graph; if the graph is undirected,
then the cost of the algorithm is halved. Notice that the function can be applied to determine shortest
paths in a weighted graph having positive or negative weights.

1: function pathlength matrix(A, level)


2: n = size(A, 1);
3: for i = 1 : n do
4: for j = 1 : n do
5: if A(i, j) = 0 and i 6= j then
6: A(i, j) = inf;
7: end if
8: end for
9: end for
10: B = A;
11: C = inf(n);
12: for count = 1 : level − 1 do
13: for i = 1 : n do
14: for j = 1 : n do
15: if j 6= i then
16: for k = 1 : n do
17: if B(k, j) 6= inf and k 6= j then
18: C(i, j) = min(C(i, j), A(i, k) + B(k, j));
19: end if
20: end for
21: end if
22: end for
23: end for
24: A = C;
25: for i = 1 : n do
26: A(i, i) = 0;
27: end for
28: end for
29: return Path length matrix;
30: end function

In line 2 of the function Pathlength matrix, the function call size(A, 1) yields the order of the matrix
A ∈ Rn×n ; in line 6, the matrix entry A(i, j) is set to ∞. Similarly, in line 11, C is defined as an n × n
matrix with all entries equal to ∞. If the graph is unweighted and connected, then the above MATLAB
function can be modified by introducing a break before the last end for when there is no entry ∞. The
diameter of the graph then is count+1.
For both weighted and unweighted graphs, also when the graph is not connected, the above MATLAB
function with argument level = K, where 1 < K < n, computes AK,? , i.e., the matrix of the distances
4 Silvia Noschese, Lothar Reichel

between any distinct vertices of the graph using paths with at most K edges. We note that the triangle
inequality might not hold for the entries of AK,? and some entries of this matrix may have the value ∞.
We will see how the matrix An−1,? associated with a connected graph G sheds light on the communi-
cation within the network determined by the graph. In fact, as a measure of the ease of communication in
the graph, we like to use the average inverse geodesic length of G (i.e., its global efficiency, cf. Section 3)
instead of the maximum geodesic length of G (i.e., its diameter). To this end, we introduce the reciprocal
(n−1,?,−1) n
path length matrix An−1,?,−1 = [aij ]i,j=1 obtained by replacing the off-diagonal entries of the path
length matrix by their reciprocals, i.e.,
(n−1,?,−1) (n−1,?)
aij = 1/aij , 1 ≤ i, j ≤ n,

where 1/∞ is identified with 0.


We are interested in determining the shortest paths that use at most K edges. We therefore also
(K,?,−1) n (K,?,−1) (K,?)
consider the reciprocal K-path length matrix AK,?,−1 = [aij ]i,j=1 , with aij = 1/aij . Thus,
(K,?,−1) (K,?)
the entry aij vanishes if aij = ∞. Note that the same would happen if K = n − 1, in case the
graph G that determines the adjacency matrix A is not connected. The matrix AK,?,−1 allows us to define
the global K-efficiency of G; cf. Section 3.
In order to enhance communication using paths with at most K edges, with 1 < K < n, i.e., to
increase the global K-efficiency of the graph associated with the adjacency matrix A, we select edge
weights by analyzing centrality properties of the vertices of the graph and, if computationally feasible,
the spectral properties of the reciprocal K-path length matrix AK,?,−1 . In detail, if K  n and the
(sparse) non-negative reciprocal K-path length matrix AK,?,−1 is irreducible, then we apply the Perron-
Frobenius theory by following the approach in [4, 7]. In our context, the choice of weights is dictated by
the analysis of the sensitivity to perturbations in A.
Applications of our approach include city planning and information transmission. As for disease prop-
agation, a recent research study of the Zhejiang City Planning Center (China) pointed out a strong
connection between the spread of the Covid-19 epidemic and the shape of the city. Cities with a radial
structure (such as Milan) have good internal connections due to the capillarity of the public transporta-
tion system - buses, trams, subways, and trains. This dynamic made citizens of such cities more vulnerable
to the arrival of the Covid-19 virus: the incidence of infections compared to the number of inhabitants
was generally larger in cities with a radial urban structure than in cities without this structure, due to
the good communication of the people in cities with radial urban structure.
This paper is organized as follows: Section 2 analyzes differences and similarities of powers and tropical
powers of the adjacency matrix for undirected and unweighted graphs. Section 3 reviews well-known
measures that can be easily computed by means of the path length matrix and introduces novel ones.
In Section 4 we present two algorithms that determine which edge-weight should be changed in order to
boost global efficiency. Changing the edge weights may entail widening streets or increasing the number
of trams on a route, decreasing travel times on a highway by increasing the travel speed, or decreasing
the waiting time for trams on a route. Finally, numerical tests are reported in Section 5 and concluding
remarks can be found in Section 6.

2 Powers versus tropical powers

Consider an undirected and unweighted simple graph G with adjacency matrix A ∈ Rn×n . Then the
(k) (k)
entry aij of the matrix Ak = [aij ]ni,j=1 ∈ Rn×n counts the number of walks of length k between the
vertices vi and vj . A matrix function based on the powers Ak that is analytic at the origin, and vanishes
there, can be defined by a formal Maclaurin series

X
f (A) = c k Ak , (2)
k=1
Network analysis with the aid of the path length matrix 5

where we for the moment ignore the convergence properties of this series. Usually long walks are considered
less important than short walks, because information flows more easily through short walks than through
long ones. Therefore matrix functions applied in network analysis generally have the property that 0 ≤
ck+1 ≤ ck for all k ≥ 1. The most common matrix function used in network analysis is the matrix
exponential; see [5, 6,8–10] for discussions and illustrations. We prefer to use the the modified matrix
exponential

exp0 (A) := exp(A) − I,

where I denotes the identity matrix, because the first term in the Maclaurin series of exp(A) has no
natural interpretation in the context of network modeling. For the modified matrix exponential, we have
ck = 1/k!, and the series (2) converges for any adjacency matrix A.
The communicability between distinct vertices vi and vj , i 6= j, is defined by

∞ (k)
X aij
[exp0 (A)]ij = ;
k!
k=1

see [8] for the analogous definition based on exp(A). The communicability accounts for all possible routes
of communication between the vertices vi and vj in the network defined by the adjacency matrix A, and
assigns a larger weight to shorter walks than to longer ones. The larger the value of [exp0 (A)]ij , the better
is the communicability between the vertices vi and vj .

(b
k)
k, 1 ≤ b
Remark 1 Notice that even if there exists an integer b k < n − 1, such that aij > 0, one may
(b
k+1)
have aij = 0. Information provided by An−1 does not include information provided by all Ah for
1 ≤ h < n − 1. This is one of the reasons for the interest in the matrix functions exp0 (A) and exp(A).

It is straightforward to show the following result.

(b
k)
k, 1 ≤ b
Proposition 1 Let b k < n, be the smallest integer power such that aij = p > 0, that is to say,

(h) (b
k)
aij = 0, ∀h < b
k, aij = p.

Then b
k is the length of the shortest path that connects vi and vj , i.e.,

(h,?) (h,?)
aij = ∞, ∀h < b
k, aij =b
k, ∀h ≥ b
k,

and p is the number of shortest paths that connect vi and vj .

Example 1 In view of Proposition 1, the information provided by both the path length matrix and a
suitable power of the adjacency matrix is of interest. Consider the undirected and unweighted graphs G1
and G2 depicted in Figures 1-2. The adjacency matrices of these graphs are

 
0 0 1 1 1
 
0 0 1 1 1 001
 
 
A1 = 
1 1 0 0 0, A2 = 0 0 1 .
 

1 1 0 0 0 110
 
1 1 0 0 0
6 Silvia Noschese, Lothar Reichel

v4

v1 v3 v2

v5

Fig. 1 Graph G1 in Example 1.

v1 v3 v2

Fig. 2 Graph G2 in Example 1.

For both graphs, the shortest path between the vertices v1 and v2 has length 2. However, in G1 there
are three shortest paths that connect v1 and v2 , while there is only one in G2 . Thus, there is surely better
communication between these vertices in G1 than in G2 , even though this information is not provided by
the path length matrices for these graphs. The path length matrices are
 
02111
 
2 0 1 1 1 021
 

A4,? A2,?
 
1 = 1 1 0 2 2 , 2 = 2 0 1 . (3)
   

1 1 2 0 2 1 1 0
 
 
11220
On the other hand, the second powers of the above adjacency matrices are
 
33000
 
3 3 0 0 0 110
 

A21 =  A22 = 1 1 0 .
 
0 0 2 2 2 ,
  

0 0 2 2 2 002
 
00222
(k)
Remark 2 For weighted graphs, the interpretation of the entry aij of the matrix Ak has to be modified.
(k)
Indeed, aij yields the sum of all products of all weights of the edges in the walks of length k between
the vertices vi and vj . (In the unweighted case, any product of all weights of the edges in a walk is 1.)
Remark 1 holds true, while Proposition 1 does not.

3 Measures that depend on the path length matrix

Let for now the graph G be undirected.


Network analysis with the aid of the path length matrix 7

3.1 Closeness centrality

Let the graph G be connected. Then the reciprocal of the sum of all lengths of the shortest paths
starting from vertex vi ,
1
ci = P (n−1,?)
= [An−1,? 1i ]−1 ,
a
j6=i ij

where 1i ∈ Rn denotes the vector with all zero entries except for the ith entry, which is one, is referred to
as the closeness centrality of vi in G; see, e.g., [2]. This measure gives a large value to vertices that have
small shortest path distances to the other vertices of the graph.

3.2 The radius and center of a network

The maximum length over all shortest paths starting from vertex vi in a weighted or unweighted
connected graph G, that is to say,
(n−1,?)
ei = max aij ,
j6=i

is commonly referred to as the eccentricity of the vertex vi . The diameter may be seen as the maximum
eccentricity among the vertices of the network. The radius rG of G is the minimum eccentricity of a vertex.
One has
(n−1,?)
rG = min max aij .
i j6=i

It is shown in [3] that


rG ≤ dG ≤ 2rG .

A vertex is said to be central if its eccentricity is equal to the radius of the graph. The center of the
graph is the set of all central vertices; see, e.g., [8].

3.3 Average shortest path length

The average shortest path length of a weighted or unweighted connected graph G computed over all
possible pairs of vertices in the network [2] is given by
1 X (n−1,?) 1
aG = aij = 1T An−1,? 1,
n(n − 1) n(n − 1)
i,j6=i

where 1 ∈ Rn denotes the vector with all entries one. Let the graph G be unweighted and be formed
by a path of n vertices. Then the largest average shortest path length is aG = (n + 1)/3. If aG scales
logarithmically with n, then G displays the “small-world phenomenon”; see, e.g., [8].

3.4 Harmonic centrality and global efficiency

The efficiency of a path between any two vertices of a weighted or unweighted graph G is defined as
the inverse of the length of the path. The sum of the inverses of the length of all shortest paths starting
from vertex vi , i.e., the sum of the efficiencies of all shortest paths starting from vi ,
X (n−1,?)
hi = [aij ]−1 , (4)
j6=i

is referred to as the harmonic centrality of vi ; see, e.g., [2]. The latter measure gives a large centrality to
vertices vi that have small shortest path distances to the other vertices of the graph. Harmonic centrality
will play a central role in our analysis. We define the h-center of a graph as the set of all vertices with
the largest harmonic centrality.
8 Silvia Noschese, Lothar Reichel

G dG rG aG eG
G1 2 2 1.40 0.80
G2 2 1 1.33 0.83
Table 1 Example 2. Diameter, radius, average shortest path length, and global efficiency of the graphs G1 and G2 depicted
in Figures 1-2. Note that the average shortest path length of G2 is maximal; indeed, (n + 1)/3 = 1.33.

If the graph is connected, then the average shortest path efficiency over all possible pairs of vertices,
also known as the average inverse geodesic length, is referred to as the global efficiency of the graph [2]:
1 X (n−1,?)
eG = [aij ]−1 . (5)
n(n − 1)
i,j6=i

Finally, we remark that in the context of molecular chemistry, the sum of reciprocals of distances
between all pairs of vertices of an undirected and unweighted connected graph is known as the Harary
index and the reciprocal path length matrix An−1,?,−1 is referred to as the Harary matrix [17].

Remark 3 The measures (4) and (5) can be especially useful when the network has more than one
connected component, because infinite distances do not contribute to these “harmonic” averages.

Example 2 As an illustration of the above measures, consider again the graphs G1 and G2 of Example 1.
Table 1 reports the diameter, radius, average shortest path length, and global efficiency of these graphs.
Notice that the center of G1 is given by the set of all vertices and the center of G2 is made up of the
vertex v3 , only. The h-center of G1 is formed by the vertices v1 and v2 , and the h-center of G2 is given by
the vertex v3 , only. Table 2 shows the eccentricity, harmonic centrality, and closeness centrality of all the
vertices of G1 and G2 . All the measures in this example are computed by using the path length matrices
(3).

vi (G1 ) ei hi ci
1 2 3.50 0.20 vi (G2 ) ei hi ci
2 2 3.50 0.20 1 2 1.50 0.33
3 2 3.00 0.17 2 2 1.50 0.33
4 2 3.00 0.17 3 1 2.00 0.50
5 2 3.00 0.17
Table 2 Example 2. Eccentricity, harmonic centrality, and closeness centrality of the vertices of G1 (left table) and of G2
(right table).

3.5 Harmonic K-centrality and global K-efficiency

When one considers shortest paths that are made up of at most K edges, the matrix AK,?,−1 takes
the role of the reciprocal path length matrix An−1,?,−1 . We are in a position to introduce the harmonic
K-centrality of the vertex vi . It is given by
X (K,?)
hKi = [aij ]−1 .
j6=i

The global K-efficiency of a graph G is defined by


1 X (K,?)
eK
G = [aij ]−1 .
n(n − 1)
i,j6=i

The set of all vertices of a graph G with the largest harmonic K-centrality is referred to as the hK -center
of the graph.
Network analysis with the aid of the path length matrix 9

vi (G̃2 ) ei hi ci
1 1.50 1.67 0.40
2 1.50 2.67 0.50
3 1.00 3.00 0.67
Table 3 Example 3. Eccentricity, harmonic centrality, and closeness centrality of the vertices of G̃2 .

3.6 Out-centrality versus in-centrality

Let the graph G be directed. Then the above centrality measures (closeness, eccentricity, harmonic
centrality, and harmonic K-centrality) determine the importance of a vertex vj by taking into account the
paths that start at vj . These measures therefore may be considered measures of out-centrality. One also
may be interested in measuring the importance of a vertex vj by considering the paths that end at it, that
is to say by measuring the in-centrality of vj . This can be achieved by replacing the path length matrix
An−1,? in the measures mentioned by its transpose. This allows us to introduce the measures closeness
in-centrality, in-eccentricity, harmonic in-centrality, and harmonic Kin -centrality. These measures are
defined as
1 (n−1,?)
X (n−1,?) X (K,?)
cin
j = P (n−1,?)
, ein
j = max aij , hinj = [aij ]−1 , hKj
in
= [aij ]−1 .
a i6=j
i6=j ij i6=j i6=j

We also define the in-radius of G,


(n−1,?)
rGin = min max aij .
j i6=j

Finally, the vertex vj is said to be in-central if its in-eccentricity equals the in-radius of the graph. The
hKin -center of a graph G is the set of all vertices with the largest harmonic Kin -centrality. The notions
of hKin -center and hKout -center will be of interest in the sequel.

4 Enhancing network communication

The diameter of a weighted or unweighted graph provides a measure of how easy it is for the vertices
of the graph to communicate. When graphs are used as models for communication networks, the diameter
plays an important role in the performance analysis and cost optimization. A simple way to decrease the
diameter of a graph so that information can be transmitted more easily between vertices of the graph [4]
is to decrease the weight of an edge that belongs to all maximal shortest paths, if feasible.

Example 3 Consider the graph G2 in Example 1. The edge e(v2 ↔ v3 ) belongs to the maximal shortest
path and is a bridge, that is its removal would make the vertex v2 unreachable and the perturbed graph
G̃2 so-obtained disconnected. In detail, the edge e(v2 ↔ v3 ) belongs to the shortest path between the
vertices v1 and v2 , which is the only shortest path of length dG . Thus, decreasing the weight of the edge
e(v2 ↔ v3 ) decreases both the average shortest path length and the diameter of the graph. Specifically,
if one decreases the weights a23 and a32 from 1 to 0.5, one obtains the matrices
   
0 0 1 0 1.5 1
Ã2 = 0 0 0.5 , Ã2,?
2 = 1.5 0 0.5 .
   

1 0.5 0 1 0.5 0

The perturbed graph G̃2 has diameter dG̃2 = 1.5, radius rG̃2 = 1, average shortest path length aG̃2 = 1,
and global efficiency eG̃2 = 1.22. The eccentricity, harmonic centrality, and closeness centrality of the
vertices of the graph G̃2 are reported in Table 3.

4.1 Increasing the global K-efficiency

We propose two approaches to increase the global efficiency of a network.


10 Silvia Noschese, Lothar Reichel

4.1.1 The function eKG1

Let for now the graph G be directed. The first approach is based on the observation that the most
important vertices with respect to the global K-efficiency live in the vertex subsets hKout -center and hKin -
center of the graph. These vertices may be interpreted as important intermediaries, that quickly collect
information from many vertices and quickly broadcast it to many others vertices. Indeed, strengthen-
ing an existing connection from a vertex of the hKin -center to a vertex of the hKout -center is likely to
strengthen their communicability by having new shorter paths with at most K steps that exploit these
connections. This is likely to increase the global K-efficiency more than strengthening an existing con-
nection between vertices with lower harmonic Kin - and Kout -centrality. Here we consider graphs whose
edge weights represent travel times or waiting times. Hence, strengthening is achieved by decreasing
appropriate weights.
We construct the perturbed adjacency matrix

à = A + γh1 ,h2 1h1 1Th2 , with γh1 ,h2 = −ah1 ,h2 /2, (6)

If the graph is undirected, the above approach simplifies, because the hKout - and hKin -centers coincide.
Hence, the idea is to strengthen the connection between vertices with the largest harmonic K-centrality.
The perturbed adjacency matrix à will be

à = A + γh1 ,h2 (1h1 1Th2 + 1h2 1Th1 ). (7)

The MATLAB function eKG1 describes the necessary computations. The operator == in line 5 of the
function eKG1 stands for logical equal to, and the symbol ./ in line 6 denotes element-wise division. The
function call sum(M ) for a matrix M ∈ Rn×n computes a row vector m ∈ Rn , whose j th component is
the sum of the entries of the j th column; the function call sum(M, 2) for a matrix M ∈ Rn×n computes
a column vector, whose ith entry is the sum of the elements of row i of M . The blip in line 8 denotes
transposition, and the operator .∗ in line 11 stands for vector-vector element-wise product.

1: function eKG1(A, flagsym, K);


2: n = size(A, 1);
3: P = pathlength matrix(A, K);
4: Pr = P;
5: P r(P r == inf) = 0;
6: P r(P r > 0) = 1./P r(P r > 0);
7: Hin = sum(P r);
8: H = sum(P r, 2)0 ;
9: eKG = 1/(n(n − 1)) sum(H);
10: [∼, h] = max(Hin );
11: [∼, k] = max(H. ∗ A(h, :));
12: A(h, k) = A(h, k)/2;
13: if flagsym then
14: A(k, h) = A(h, k);
15: end if
16: return A, eKG;
17: end function

4.1.2 The function eKG2

Assume for now that the graph G is directed. If computing the Perron root ρK and the unique
positive left and right eigenvectors of unit norm (the Perron vectors) of the reciprocal K-path length
matrix AK,?,−1 is not computationally feasible or if this matrix is not irreducible, then one can use the
function eKG1. However, if AK,?,−1 is irreducible and its left and right Perron vectors xK = (xK,i ) and
Network analysis with the aid of the path length matrix 11

yK = (yK,i ) can be computed, then these vectors determine the Wilkinson perturbation WK = yK xTK ;
see [20, Section 2]. Following [7], to induce the maximal perturbation in ρK , one chooses the indices
(h1 , h2 ) such that WK (h1 , h2 ) is the largest entry of WK and A(h1 , h2 ) > 0, i.e., the indices of the largest
entry of the Wilkinson perturbation “projected” onto the zero-structure of A; see, e.g. [15]. Thus,

(h1 , h2 ) : xK,h2 yK,h1 = (yK xTK )h1 ,h2 = max (WK )i,j .
i,j:A(i,j)>0

As in function eKG1, one strengthens the edge e(vh1 → vh2 ) by halving its weight. The perturbed
adjacency matrix then is given by (6).
When the graph G is undirected, the left and right Perron vectors coincide and the perturbed adjacency
matrix is constructed as in (7). The outlined approach is implemented by the MATLAB function eKG2.
We recall that the function abs(v) of a vector v, used in the function eKG2, returns a vector, whose
components are the absolute value of the components of v. The expression sum(sum(P r)) on line 7 sums
all entries of the matrix P r. The operator .∗ on line 20 denotes the Hadamard product of two matrices;
the entries of the matrix A > 0 are one if the corresponding entry of A is positive; they are zero otherwise.
The function ind2sub determines the equivalent subscript values corresponding to a given single index in
an array.

1: function eKG2(A, flagsym, K)


2: n = size(A, 1);
3: P = pathlength matrix(A, K);
4: Pr = P;
5: P r(P r == inf) = 0;
6: P r(P r > 0) = 1./P r(P r > 0);
7: eKG = 1/(n(n − 1)) sum(sum(P r));
8: if not flagsym then
9: [X, D, Y ] = eig(P r);
10: [ρ, ind] = max(abs(diag(D)));
11: x = X(:, ind);
12: y = Y (:, ind)
13: else
14: [X, D] = eig(P r);
15: [ρ, ind] = max(abs(diag(D)));
16: x = X(:, ind);
17: y = x;
18: end if
19: W = yx0 ;
20: W = W. ∗ (A > 0);
21: [∼, lin] = max(W (:));
22: [h, k] = ind2sub([n, n], lin);
23: A(h, k) = A(h, k)/2;
24: if flagsym then
25: A(k, h) = A(h, k);
26: end if
27: return A, eKG
28: end function

We expect the global K-efficiency to increase the most when decreasing the edge-weight that makes
the Perron root ρK change the most. The perturbation of the Perron root generated by the function
eKG2 typically is larger than the perturbation determined by the function eKG1. The difference in these
perturbations is analogous to the difference between considering the most important vertex in a graph
the one with the largest degree and the one with maximal eigenvector centrality.

Remark 4 Both functions eKG1 and eKG2 maximize lower bounds for the global K-efficiency of the
network. Consider for the sake of clarity the undirected case. Let hK denote the vector of the harmonic
12 Silvia Noschese, Lothar Reichel

K-centralities of the vertices of the graph. Its 1-norm is the sum in the numerator of the global K-
efficiency, and its ∞-norm is what function eKG1 is maximizing. Indeed, one has

n(n − 1) eK
G = khK k1 ≥ khK k∞ = kA
K,?,−1
k ∞ ≥ ρK .

Remark 5 The Perron root is bounded from below and from above by the minimal and maximal entries
of hK , respectively. We have
X (K,?) X (K,?)
min [aij ]−1 ≤ ρK ≤ max [aij ]−1 = khK k∞ . (8)
i i
j6=i j6=i

Indeed, one has


1T AK,?,−1 xK = 1T ρK xK = ρK kxK k1

and
n
X X (K,?)
1T AK,?,−1 xK = xTK AK,?,−1 1 = (xK,i [aij ]−1 ),
i=1 j6=i

so that one obtains (8) by observing that


X (K,?) X (K,?)
min [aij ]−1 kxK k1 ≤ ρK kxK k1 ≤ max [aij ]−1 kxK k1 .
i i
j6=i j6=i

Example 4 We apply the functions eKG1 and eKG2 to the graphs of Example 1. For neither graph, there
is a unique “best choice” to report.
First consider the graph G1 in Example 1. Then A2,? 3,? 4,?
1 = A1 = A1 . We let K = 2 and obtain
 
0 0.5 1 1 1
0.5 0 1 1 1 
 

A2,?,−1
 
1 =
 1 1 0 0.5 0.5 .

 1 1 0.5 0 0.5
 
1 1 0.5 0.5 0

The vector h2 of harmonic 2-centralities is h2 = [3.5, 3.5, 3, 3, 3]T , while the Perron vector x2 is given by
x2 = [0.47, 0.47, 0.43, 0.43, 0.43]T . This tells us that the vertices v1 and v2 are the most important ones
in the sense of both harmonic centrality and eigenvector centrality. Indeed, these vertices are the only
ones that are connected by paths of minimal length with three vertices. Thus, they are well connected.
However, A1 (1, 2) = 0.
Both functions eKG1 and eKG2 give (h1 , h2 ) = (1, 3), and yield the matrix
 
0 0 0.5 1 1
 0 0 1 1 1
 
 
Ã1 = 0.5 1 0 0 0 ,

 1 1 0 0 0
 
1 1 0 00

even though other choices of existing edges are equally valid. The global 2-efficiency e2G̃ of Ã1 is 0.95;
1
compare with the global 2-efficiency e2G1 = 0.80 of A1 . We remark that a perturbation of another existing
edge would have led to the same increase of the global 2-efficiency.
Consider the graph G2 in Example 1. One has
 
0 0.5 1
A2,?,−1 = 0.5 0 1 .
 
2
1 1 0
Network analysis with the aid of the path length matrix 13

The vector of harmonic 2-centralities is h2 = [1.5, 1.5, 2]T , while the Perron vector is given by x2 =
[0.54, 0.54, 0.64]T . Both functions eKG1 and eKG2 yield (h1 , h2 ) = (3, 1), even though the choice (h1 , h2 ) =
(3, 2) is equally valid and gives the matrix
 
0 0 0.5
Ã2 =  0 0 1  .
 

0.5 1 0

The global 2-efficiency of Ã2 is e2G̃ = 1.22, while the global 2-efficiency of the matrix A2 is e2G2 = 0.83.
2

The diameter associated with the graph determined by Ã2 is only 1.5, while the diameter of the graph
associated with A2 is 2. The choice (h1 , h2 ) = (3, 2), which was considered in Example 3, gives the same
results.

5 Numerical tests

The numerical tests reported in this section have been carried out using MATLAB R2022b on a
3.2 GHz Intel Core i7 6 core iMac. The Perron root and left and right Perron vectors for small to
moderately sized graphs can easily be evaluated by using the MATLAB function eig. For large-scale
graphs these quantities can be computed by the MATLAB function eigs or by the two-sided Arnoldi
algorithm, introduced by Ruhe [18] and improved by Zwaan and Hochstenbach [21].

Example 5 Consider the adjacency matrix for the network Air500 in [1]. This data set describes flight
connections for the top 500 airports worldwide based on total passenger volume. The flight connections
between airports are for the year from 1 July 2007 to 30 June 2008. The network is represented by a
directed unweighted connected graph with 500 vertices and 24009 directed edges. The vertices of the
network are the airports and the edges represent direct flight routes between two airports.
The path length matrix A5,? = A499,? yields the diameter and the radius of the graph 5 and 3,
respectively. The information provided by the vector of the harmonic centralities and the Perron vector
for the reciprocal path length matrix A5,?,−1 is the same as the one given by the vector of harmonic
K-centralities and the Perron vector for AK,?,−1 with K = 2; cf. Table 4. Therefore, the perturbation
that increases the global K-efficiency the most also will enhance the global efficiency the most. The
information provided by Table 4 suggests that the number of flights from the Frankfurt FRA Airport
(vertex v161 ) to the JFK Airport in New York (vertex v224 ) should be doubled in order to half the wait
time between these flights. Doubling the number of flights corresponds to halving the weight for the
corresponding edge.

K (h1 , h2 ) eK
G eK

5 (161, 224) 0.4839 0.4856
4 (161, 224) 0.4839 0.4855
3 (161, 224) 0.4791 0.4807
2 (161, 224) 0.3604 0.3606
Table 4 Example 5. Indices chosen by the functions eKG1 and eKG2 and the global K-efficiency of both the given graph,
G, and the perturbed graph, G̃, for K = 2, 3, 4, 5.

Example 6 This example considers an undirected unweighted connected graph G that represents the
German highway system network Autobahn. The graph is available at [1]. Its 1168 vertices are German
locations and its 1243 edges represent highway segments that connect them.
Let A be the adjacency matrix associated with G. The path length matrix A62,? = A1167,? shows
that the diameter and the radius of G are 62 and 34, respectively, whereas its global efficiency equals
14 Silvia Noschese, Lothar Reichel

6.7175 · 10−2 . One notices that there is only one shortest path of length 62, which connects the vertices
v116 and v1154 . The diameter of the graph can be decreased by halving the weight of the edges a120,116
and a116,120 (since the graph is undirected), because this is the unique edge that connects the vertex v116
to the other vertices of the graph.
Let  denote the perturbed adjacency matrix and Ĝ the corresponding graph. The global efficiency
of Ĝ is 6.7177 · 10−2 and the diameter is 61.5. We turn to the application of the functions eKG1 and
eKG2 to increasing the global efficiency. Table 5 reports the global K-efficiency (for several values of K)
of the graph G̃ associated with the adjacency matrix à obtained by halving both entries ah1 ,h2 and ah2 ,h2
of A, computed by the function eKG1. Table 6 shows the global K-efficiency (for several values of K)
of the graph G̃ associated with the adjacency matrix Ã, computed by the function eKG2. Also in this
example, the information provided by the vector of harmonic centralities and the Perron vector for the
reciprocal path length matrix A62,?,−1 is exactly the same information that is provided by the vector of
harmonic K-centralities and the Perron vector for AK,?,−1 with K ≥ 4. We note that the latter vectors
are less expensive to determine than the former. The information provided by both tables suggests that
one should double the width of the highway that connects the cities of Duisburg (vertex v219 ) and Krefeld
(vertex v565 ) to half the travel time. These cities are 10 miles apart. Doubling the width corresponds to
halving the weight associated with the corresponding edge.

K (h1 , h2 ) eK
G eK

62 (219, 565) 6.7175 · 10−2 6.7559 · 10−2
52 (219, 565) 6.7166 · 10−2 6.7550 · 10−2
42 (219, 565) 6.6965 · 10−2 6.7349 · 10−2
32 (219, 565) 6.5105 · 10−2 6.5485 · 10−2
22 (219, 565) 5.5674 · 10−2 5.6024 · 10−2
12 (219, 565) 2.8426 · 10−2 2.8621 · 10−2
5 (219, 565) 7.9991 · 10−3 8.0304 · 10−3
4 (219, 565) 6.1823 · 10−3 6.2019 · 10−3
3 (219, 217) 4.6017 · 10−3 4.6112 · 10−3
2 (219, 217) 3.2082 · 10−3 3.2124 · 10−3
Table 5 Example 6. Indices chosen by function eKG1 and global K-efficiency of both G and G̃, for K = 2, 3, 4, 5 and for
K = 12 : 10 : 62.

K (h1 , h2 ) eK
G eK

62 (565, 219) 6.7175 · 10−2 6.7559 · 10−2
52 (565, 219) 6.7166 · 10−2 6.7550 · 10−2
42 (565, 219) 6.6965 · 10−2 6.7349 · 10−2
32 (565, 219) 6.5105 · 10−2 6.5485 · 10−2
22 (565, 219) 5.5674 · 10−2 5.6024 · 10−2
12 (565, 219) 2.8426 · 10−2 2.8621 · 10−2
5 (565, 219) 7.9991 · 10−3 8.0304 · 10−3
4 (565, 219) 6.1823 · 10−3 6.2019 · 10−3
3 (267, 219) 4.6017 · 10−3 4.6111 · 10−3
2 (693, 543) 3.2082 · 10−3 3.2136 · 10−3
Table 6 Example 6. Indices chosen by function eKG2 and global K-efficiency of both G and G̃, for K = 2, 3, 4, 5 and for
K = 12 : 10 : 62.

6 Concluding remarks

The adjacency matrix of a graph is a well-known tool for studying properties of a network defined by
the graph. The path length matrix associated with a graph also sheds light on properties of the network,
Network analysis with the aid of the path length matrix 15

but so far has not received much attention. A review of measures that can be defined in terms of the path
length matrix is provided, and new such measures are introduced. The sensitivity of the transmission of
information to perturbations of the entries of the adjacency matrix is investigated.

Data availability statement

Data sharing not is applicable to this article as no new datasets were generated during the current
study.

Conflict of interest

The authors declare that they have no conflict of interest.

Funding

There is no funding available.

Authors’ contributions

All author contributed equally to the paper.

References

1. Dynamic Connectome Lab - Data Sets. https://sites.google.com/view/dynamicconnectomelab


2. A. Barrat, M. Barthelemy, and A. Vespignani, Dynamical processes on complex networks, Cambridge University Press,
Oxford, 2008.
3. J. Clark and D. A. Holton, A First Look at Graph Theory, World Scientific, Singapore, 1991.
4. O. De la Cruz Cabrera, J. Jin, S. Noschese, and L. Reichel, Communication in complex networks, Appl. Numer. Math.,
172 (2022), pp. 186–205.
5. O. De la Cruz Cabrera, M. Matar, and L. Reichel, Analysis of directed networks via the matrix exponential, J. Comput.
Appl. Math., 355 (2019), pp. 182–192.
6. O. De la Cruz Cabrera, M. Matar, and L. Reichel, Edge importance in a network via line graphs and the matrix
exponential, Numer. Algorithms, 83 (2020), pp. 807–832.
7. S. El-Halouy, S. Noschese, and L. Reichel, Perron communicability and sensitivity of multilayer networks, Numer.
Algorithms, 92 (2023), pp. 597–617.
8. E. Estrada, The Structure of Complex Networks: Theory and Applications, Oxford University Press, Oxford, 2011.
9. E. Estrada and J. A. Rodriguez-Velazquez, Subgraph centrality in complex networks, Phys. Rev. E, 71 (2005), Art.
056103.
10. C. Fenu, L. Reichel, and G. Rodriguez, SoftNet: A package for the analysis of complex networks, Algorithms, 15 (2022),
Art. 296.
11. R. L. Graham and H. O. Pollak, On the addressing problem for loop switching, The Bell System Technical Journal, 50
(1971), pp. 2495–2519.
12. G. L. Litvinov, Maslov dequantization, idempotent and tropical mathematics: A brief introduction, J. Math. Sci., 140
(2007), pp. 426–444.
13. M. E. J. Newman, Analysis of weighted networks, Phys. Rev E, 70 (2004), Art. 056131.
14. M. E. J. Newman, Networks: An Introduction, Oxford University Press, Oxford, 2010.
15. S. Noschese and L. Pasquini, Eigenvalue condition numbers: Zero-structured versus traditional, J. Comput. Appl. Math.,
185 (2006), pp. 174–189.
16. S. Noschese and L. Reichel, Estimating and increasing the structural robustness of a network, Numer. Linear Algebra
Appl., 29 (2022), Art. e2418.
17. D. Plavsic, S. Nikolic, N. Trinajstic, and Z. Mihalic, On the Harary index for the characterization of chemical graphs,
J. Math. Chem., 12 (1993), pp. 235–250.
18. A. Ruhe, The two-sided Arnoldi algorithm for nonsymmetric eigenvalue problems, Matrix Pencils, eds. B. Kågström
and A. Ruhe, Springer, Berlin, 1983, pp. 104–120.
16 Silvia Noschese, Lothar Reichel

19. A. Taylor and D.J. Higham, A Controllable Test Matrix Toolbox for MATLAB, ACM Trans. Math. Software, 35 (2009),
pp. 26:1-26:17.
20. J. H. Wilkinson, Sensitivity of eigenvalues II, Util. Math., 30 (1986), pp. 243–286.
21. I. N. Zwaan and M. E. Hochstenbach, Krylov-Schur-type restarts for the two-sided Arnoldi method, SIAM J. Matrix
Anal. Appl., 38 (2017), pp. 297–321.

You might also like