Professional Documents
Culture Documents
www.elsevier.com/locate/laa
Abstract
Linear periodicity of matrices in max-plus algebra is studied. It is proved that the linear
period of a matrix can be computed in O(n3 ) time if the digraph of the matrix is strongly
connected. The general problem of deciding whether a given matrix is almost linear periodic
is shown to be NP-complete. 2000 Published by Elsevier Science Inc. All rights reserved.
AMS classification: 04A72; 05C50; 15A33
Keywords: Linear matrix period; Max-plus algebra; NP-completeness
1. Introduction
Discrete dynamic systems and related algebraic structures are often studied using
max-plus or maxmin matrix operations and digraphs [5,18]. In the maxmin matrix theory, the convergence and periodicity of matrices were studied in [3,16] and
by other authors. The periodicity of powers of fuzzy matrices in connection with
finite fuzzy relations was investigated in [12,13]. Polynomial algorithms and NPcompleteness results for matrix and orbit periods in maxmin algebra are presented
in [79].
Powers of matrices in max-plus algebra with applications to periodic graphs are
studied in [15]. For matrices with zero-weight cycles, polynomial algorithms for
computing the matrix period in max-plus algebra are described in [6,14].
168
In this paper, we define a more general notion of a linear matrix period in maxplus algebra, which makes sense for all matrices (with cycles of arbitrary weight).
We present an algorithm for computing the linear matrix period of a given matrix A
with strongly connected digraph G(A). It is also shown that, in the general case, the
problem of linear periodicity of matrices in max-plus algebra is NP-complete.
169
= v(c)/r denotes
the mean weight of c. The maximal cycle mean weight in G(A) is denoted by (A).
Throughout the paper we assume that (A) is finite, i.e. there is at least one cycle of
positive length in G(A).
We say that two vertices i, j n are highly connected, in notation: i h j if i, j
are contained in a cycle c with the maximal cycle mean weight v(c)
= (A). The
subgraphs induced by the equivalence classes of h are called highly connected
components in G(A), the set of all such components is denoted by HCCG(A). A
component K HCCG(A) is called trivial if K contains no cycle of positive length
with cycle mean weight equal to (A). The set of all non-trivial components K
HCCG(A) is denoted by HCC G(A). For any K HCCG(A), the high period of
K is defined as
hper(K) = gcd{|c|; c is a cycle in K, v(c)
= (A)}.
If K is a trivial highly connected component, then hper(K) = 0.
Next lemma describes the powers of a square matrix A G (n, n) using walks
in the digraph G(A).
Lemma 2.1 [5]. Let A G (n, n), r N + , i, j n. Then
n
o
(i,
j
)
(Ar )ij = max v(w); w WG(r)
(A)
170
It was proved in [1] (see also [4,5]) that the power sequence (A, A2 , . . .) of an
irreducible matrix A is almost linear periodic in the sense of the definitions below.
It was shown that the linear factor of A is the maximum cycle mean (A) and an
upper bound for the linear matrix period lper(A) was given. Nachtigall [15] described
the matrix power sequence as the maximum of 6 n almost linear periodic matrix
sequences and proposed an O(n6 ) algorithm for computing them.
In Section 3, we describe the exact value of the linear matrix period and an O(n3 )
algorithm for computing lper(A) in the case when A is irreducible. The algorithm
uses the notion of highly connected components and high periods defined above.
In the general case, the situation is a bit more complicated. First, it may happen
that some strongly connected components in G(A) contain no cycles with the mean
weight equal to (A). Second, it may happen that A is not linear periodic and to
recognize this is an NP-complete problem (see Section 4).
For these two reasons, we cannot immediately apply the results from Section 3
and compute the linear matrix period of a reducible matrix using the highly connected components and their high periods in individual irreducible components. Complete solution of the general case and a further NP-completeness result will be presented in [10].
Definition 2.3. We say that a sequence a = ( a (r); r N ) in G is almost linear
periodic if there are q G, p N + and R N such that for every r > R
a (r+p) = a (r) + p q.
The element q = lfac(a ) is called the linear factor of a and the smallest numbers
R = ldef(a ), p = lper(a ) with the above properties are called the linear defect and
the linear period, respectively, of a .
Definition 2.4. We say that a sequence A = ( A(r); r N ) of matrices in G (m, n)
(r)
is almost linear periodic if the sequence aij = ( aij ; r N ) is almost linear periodic, for all i m, j n. The matrix lfac(A ) = ( lfac(aij ); i m, j n ) is called
the linear factor matrix of A and the numbers ldef(A ) = max{ldef(aij ); i m,
j n}, lper(A ) = lcm{lper(aij ); i m, j n} are called the linear defect and the
linear period of A , respectively.
Definition 2.5. We say that a square matrix A G (n, n) is almost linear periodic if the power sequence A = ( Ar ; r N ) is almost linear periodic. The matrix
lfac(A) = lfac(A ) is called the linear factor matrix of A and ldef(A) = ldef(A ),
lper(A) = lper(A ) are called the linear defect and the linear period of A.
The next example shows two matrices A, B R (6, 6). There is only a slight
difference between A, B, however, A is almost linear periodic and B is almost linear
non-periodic.
Example 1.
.
.
.
A=
.
.
.
.
.
1
.
.
.
0
1
.
.
.
.
0
.
.
.
1
.
.
.
.
0
.
.
.
.
0
,
0
.
.
.
.
.
B=
.
.
.
0
.
1
.
.
.
.
1
.
.
.
.
0
.
.
.
1
.
.
.
.
0
.
.
171
.
.
0
.
0
.
.
For simplicity, the values in A, B are replaced by dots and the 0 weights of arcs
in G(A) and G(B) are not indicated. Using Lemma 2.1, it is easy to see that, for
(i, j ) =
/ (0, 5), the sequences aij and bij are of one of the following three types:
Type 1: Eventually constant value .
Type 2: Eventually value on even positions, finite values with constant increment
2 or 1 on odd positions.
Type 3: Eventually value on odd positions, finite values with constant increment
2 or 1 on even positions.
/ (0, 5) are almost linear periodic
Therefore, all sequences aij , bij with (i, j ) =
with linear factor 0 (type 1), or with linear factor 1 or 1/2 (types 2 and 3).
is the maximum of two sequences a 0 , a 00 . The sequence a 0 is
The sequence a05
induced (according to Lemma 2.1) by walks from 0 to 5 visiting the vertex 2 and,
therefore, a 0 has the linear factor 1, while the sequence a 00 is induced by walks from
0 to 5 visiting the vertex 3 and has the linear factor 1/2. As both sequences are of
type 3, and lfac(a 0 ) > lfac(a 00 ), a 0 eventually dominates a 00 and, as a consequence,
= max(a 0 , a 00 ) is almost linear periodic with linear factor 1.
a05
is the maximum of two sequences b 0 , b 00 . The seSimilarly, the sequence b05
quence b 0 is induced by walks from 0 to 5 visiting the vertex 1 and, therefore, b0 has
the linear factor 1, while the sequence b 00 is induced by walks from 0 to 5 visiting the
vertex 3 and has the linear factor 1/2. As the sequence b0 is of type 2, while the se = max(b 0 , b 00 ) has a subsequence
quence b 00 is of type 3, the maximum sequence b05
with linear factor 1 on odd positions and a subsequence with linear factor 1/2 on
is almost linear non-periodic.
even positions. Therefore, b05
172
173
Claim 2. For any w W, the sequence aw is almost linear periodic with lfac(aw ) =
(A) and lper(aw )|p .
Proof of Claim 2. For any k p we define
0
Wwk = w0 WG(r)
(A) (i, j ); w c w , r k mod p ,
/ ,
(K HCC G(A)) K w0 =
awk =max{v(w0 ); w0 Wwk }.
Any cycle-extension w0 WG(r)
(A) (i, j ) can be created from w by consecutive inserting of elementary cycles. In the above definition of awk , it is sufficient to consider
only such cycle-extensions w0 , in which every elementary cycle is used less than p
times. Otherwise, w0 could be reduced, by deleting p of occurrences of an elementary cycle, to a cycle-extension w00 , w c w00 c w0 with |w0 | |w00 | mod p ,
v(w0 ) 6 v(w00 ). Thus, awk can be considered as a maximum of a finite set in G ,
because the set of all elementary cycles in G(A) is finite. As a consequence, awk is
well-defined in G , for every k p .
Let k p be arbitrary, but fixed. We shall consider two cases:
/ and let w0 Wwk , v(w0 ) = awk . Then there is K
Case 1. Let Wwk =
174
(r+p )
(r)
aw
= aw
+ p (A).
aij
= aij + p (A)
(r)
k
mod
p
.
ak = max v(w); w WG(r)
K
(A)
Analogously as in the proof of Lemma 3.2, we can prove that the values ak , k pK
(r)
are well-defined and aii = ak holds true for all large enough r N, r k mod pK .
Therefore, the sequence aii is almost linear periodic with lfac(aii ) = (A) and lper
(aii )|pK . On the other hand, it is easy to see that
= o if k = 0,
ak
< o otherwise.
Namely, ak = o exactly when only zero-cycles are used in the definition of ak . This
is possible only for k = 0, i.e. for cycles of length r 0 mod pK , because pK is the
gcd of the lengths of all zero-cycles in K. Therefore, the value o can be found in
the sequence aii only on every pK -th position, i.e. lper(aii ) cannot be smaller than
pK .
The next two lemmas are a theoretical background for computing the linear period
lper(A) for matrices with strongly connected digraph G(A).
Lemma 3.4. Let A G (n, n) with (A) = 0, let K HCC G(A). If an edge e in
K is contained in no zero-cycle, then the high period of K will not be changed by
deleting the edge e, i.e. hper(K) = hper(K e).
Proof. By deleting e, no zero-cycle in K will be lost; therefore, K and K e have
the same set of zero-cycles.
Lemma 3.5. Let A G (n, n) with (A) = 0, let K HCC G(A). If every edge
e in K is contained in some zero-cycle, then all cycles in K are zero-cycles.
Proof. Let c be a cycle in K, let e0 , e1 , . . . , ek1 be edges in K such that c =
e0 e1 . . . ek1 . By the assumption that every edge in K is contained in some zerocycle, there are walks w0 , w1 , . . . , wk1 such that e0 w0 , e1 w1 , . . . , ek1 wk1 are
175
sk
sk
176
vertex set. The component periods are computed by BalcerVeinotts condensation algorithm [2] in total O(n2 ) time. Finally, in view of Theorem 3.1, the period
lper(A) = lper(B) is computed as lcm of all hper(K) for K HCC G(B).
The next simple example demonstrates the work of algorithm A.
Example 2. A matrix A R (6, 6) is given as the input of A. Part 1 finds the
value (A) = 1 by Karps algorithm and creates the matrix B = A ((A)) with
(B) = 0.
. 3 .
. .
.
. . 0
. 2
.
1 . . 3 .
.
,
A=
. .
.
4 . .
. . .
. . 4
. . . 1 6
.
. 2
.
. .
.
. . 1
. 1
.
2 .
.
4
.
.
.
B=
3
.
.
.
.
.
. .
.
. . 5
. .
. 2 5
.
For simplicity, the values in A, B are replaced by dots. Both matrices have
identical digraphs with weight functions differing by 1.
Part 3 comPart 2 uses Warshalls algorithm for computing the metric matrix B,
T
putes the matrix sum C = B + B . From C, we conclude that there are two highly
connected components K0 , K1 HCC G(B), generated by sets K0 = {0, 1, 2, 3}
and K1 = {4, 5}, respectively.
0
2
1 3 3 2
2
0 1 5 1 4
1
1
0 4 2 3
B=
5
4
0 6
1
3
4 2 3 7 0 5
1
3
2 2 5
0
0
0
0
C=
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
1
1
0
0
177
1
1
1
.
1
0
0
.
.
1
D=
0
.
.
.
.
.
0
B =
3
.
.
0
.
.
.
.
.
2
.
.
.
.
.
.
0
.
.
.
.
.
.
0
.
.
1
.
1
.
.
.
0
.
.
.
,
.
0
.
.
1
.
.
.
.
.
.
4
.
.
.
.
.
.
.
.
5
.
.
.
.
.
5
.
4. NP-completeness
The assertion of Theorem 3.1 substantially uses the assumption that the digraph
G(A) of the considered matrix A is strongly connected. Example 1 shows that, in
general, a matrix may be linear periodic or non-periodic, and the difference between
178
these two cases is very subtle. In this section, we show that the problem of deciding
this question is NP-complete.
Definition 4.1 (Matrix Linear Periodicity Problem (MLP)). Given a matrix A
G (n, n) over a max-plus algebra G , decide whether A is almost linear non-periodic!
To show that MLP is an NP-problem, we shall use the following theorem by
Nachtigall [15].
Theorem 4.1 [15]. Let A G (n, n) be a matrix over a max-plus algebra G .
Then there are k 6 n almost linear periodic matrices ( Al ; l k ) with lper(Al ) 6 n,
ldef(Al ) 6 3n2 and lfac(Al ) G for all l k, such that for any r N,
Ar = max{Arl ; l k}.
This representation can be found in O(n6 ) time.
Theorem 4.2. The problem MLP is an NP-problem.
Proof. If the matrix A is almost linear non-periodic, then there are i, j n such
that the sequence aij is almost linear non-periodic. By Theorem 4.1, the sequence
aij is the maximum of k 6 n almost linear periodic sequences with linear periods
6 n, which implies that the lcm of their linear periods divides n!. Therefore, the
sequence aij is almost linear non-periodic if and only if it contains two equidistant
subsequences
(R +mn!)
;mN
and
aij(R1 +mn!) ; m N ,
aij 0
/ q1 .
which are almost linear periodic with different linear factors q0 =
Thus, a certificate showing that a given matrix A G (n, n) is almost linear nonperiodic can be given as a six-tuple (i, j, q0 , q1 , R0 , R1 ), where i, j n, q0 , q1 G
(R )
(R )
with q0 =
/ q1 and R0 , R1 N, such that for all m N the values aij 0 , aij 1 are
finite and the equations
(R0 +mn!)
aij
(R0 )
= aij
+ (m n!) q0 ,
hold true.
We show that the verification of the certificate conditions can be done in polynomial time. By Theorem 4.1, there is an O(n6 ) algorithm which finds almost linear
periodic matrices ( Al ; l k) fulfilling the conditions of the theorem. It is shown in
[15] that the algorithm computes also the values lper(Al ), ldef(Al ) and lfac(Al ) for
l k. Then we define, for all l k, the least natural numbers r(0, l), r(1, l) > 3n2
with r(0, l) R0 mod lper(Al ) and r(1, l) R1 mod lper(Al ). The above certificate conditions are satisfied if and only if there are l(0), l(1) k such that lfac(Al(0))
r(0,l(0))
r(1,l(1))
)ij , (Al(1)
)ij are finite, and for any
= q0 , lfac(Al(1)) = q1 , the values (Al(0)
l k, the implications
ij
= ,
179
lfac(Al ) > q1 Alr(1,l)
=
ij
hold true. Clearly, this can be verified by computing at most 2k (3n2 + n) powers of
n n matrices, i.e. in a time polynomial with respect to n.
Further, we shall need an NP-completeness result concerning the problem of
computing the period of the maximal sequence created from a finite set of periodic
sequences.
Definition 4.2 [9]. Let D be a finite set of finite sequences with values in a linearly
ordered set B. Then for any sequence s D, of length d, we define an infinite
sequence s which is the infinite periodic extension of s: for any r N, k d,
r k mod d
s(r) := s(k)
and by sD we denote the infinite sequence which is the maximum of all infinite
periodic extensions of elements of D, i.e. for any r N
sD (r) := max s (r).
sD
180
sequence period is per(sD ) > 1. In other words, we shall show that A is a yes instance
of MLP if and only if D is a yes instance of 2-MSP1 .
Let D = (sl ; l m), let us denote by ml the length of the sequence sl for l m.
Without
P any loss of generality we may assume that ml > 1 for all l m. We put
n := {ml ; l m} + 4. Matrix A will be defined by describing the digraph G(A).
The weighted digraph G(A) = (V , E, v) consists of m disjoint cycles Cl , of
lengths ml , for all l m, one cycle C of length 2 and two vertices x, y. The vertices
in each cycle Cl and in C are enumerated by natural numbers and will be referred to
as Cl (k), k ml , or as C(k), k 2, respectively.
Besides the edges in cycles, G(A) has edges (x, Cl (0)) for l m with ml = 2,
edges (x, Cl (2)) for l m with ml > 2, edges (Cl (k), y) for l m, sl (k) = 1, and
edges (x, C(0)), (C(0), y), (C(1), y). The two edges creating cycle C have weight
1, all remaining edges in G(A) have weight 0.
The figure shows the digraph G(A) for values n = 9, m = 2, m0 = 2, m1 = 3
and D = (s0 , s1 ) with s0 = (0, 1), s1 = (1, 1, 0). In figure, the zero weights of edges
are not indicated.
In vertex order (C0 (0), C0 (1), C1 (0), C1 (1), C1 (2), C(0), C(1), x, y), the corresponding matrix A has the form
. 0
. .
0 .
. 0
.
0
.
.
0
. . 0
. 0
0 . .
. .
A=
.
1
.
0
1
. . 0
0 . . . 0
0
. . .
. . . . .
.
. . .
To make the structure of A clearer, the values are replaced by dots and the
values denoting the non-existing edges between cycles are completely omitted.
181
Clearly, the above construction of matrix A is polynomial with respect to the size
of D. We shall prove that the instances A, D are equivalent.
Let i, j n be a pair of vertices in G(A). Using Lemma 2.1, it is easy to verify
that, for (i, j ) =
/ (x, y), the sequence aij is of one of the following three types.
Type 1: Constant value . This type occurs when there is no walk from i to j, e.g.
for (i, j ) = (x, x), or for i = y, j C.
Type 2: Almost linear periodic with lfac(aij ) = 0 and lper(aij )|ml for some l m.
The sequences of this type correspond to pairs (i, j ) for which there is a walk w from
/ (x, y), then w can
i to j visiting one of the cycles C0 , . . . , Cm1 . Clearly, if (i, j ) =
visit at most one of the cycles in G(A).
Type 3: Almost linear periodic with lfac(aij ) = 1 and lper(aij ) = 1. The sequences of this type correspond to pairs (i, j ) for which there is a walk w from i to j
visiting the cycle C. If (i, j ) =
/ (x, y), then w cannot visit any other cycle in G(A).
is the maximum of m sequences a , l m, of
For (i, j ) = (x, y), the sequence axy
l
type 2 with lper(al )|ml , and one sequence a, of type 3. Every sequence al is induced
(according to Lemma 2.1) by walks from x to y, visiting the cycle Cl . Similarly, the
sequence a is induced by walks from x to y, visiting the cycle C. Moreover, for every
l m, k ml and for large enough r, r k mod ml
0 if sl (k) = 1,
(r)
al =
if sl (k) = 0.
If D is a yes instance of 2-MSP1 , i.e. if per(sD ) > 1, then there are r 0 , r 00 N
such that sD (r 0 ) = 0 and sD (r 00 ) = 1. Denoting m = lcm{ml ; l m} we get that
for any large enough r, r r 0 mod m and for all l m,
al(r) =
(r)
and axy
= a(r)
holds true. On the other hand, there is l m such that, for any large enough r, r
r 00 mod m , we have
(r)
al
(r)
= 0 and axy
= 0.
contains two equidistant subsequences, which are alTherefore, the sequence axy
and the
most linear periodic with different factors, 1 and 0. As a consequence, axy
matrix A as well, are almost linear non-periodic, i.e. A is a yes instance of MLP.
If D is a no instance of 2-MSP1 , i.e. if per(sD ) = 1, then sD has constant value 0
or 1. In the first case, all sequences in D have constant value 0 and the vertex y is not
is almost linear periodic with linear factor
accessible from the cycles Cj . Then axy
1.
In the second case, sD has constant value 1, and for any r N there is l m such
that
(r)
al
(r)
= 0 and axy
=0
182
Acknowledgement
This research has been supported by grant VEGA 1/6055/99.
References
[1] F. Bacceli, G. Cohen, G. Olsder, J.P. Quadrat, Synchronization and Linearity, Wiley, New York,
1992.
[2] Y. Balcer, A.F. Veinott, Computing a graphs period quadratically by node condensation, Discrete
Math. 38 (1973) 295303.
[3] K. Cechlrov, On the powers of matrices in bottleneck/fuzzy algebra, Linear Algebra Appl. 246
(1996) 97112.
[4] G. Cohen, D. Dubois, J.P. Quadrat, M. Viot, A linerar-system-theoretic view of discrete event
processes and its use for performance evaluation in manufacturing, IEE Trans. Automatic Control
AC-30 (1985) 210220.
[5] R.A. Cuninghame-Green, Minimax algebra, Lecture Notes in Economics and Mathematical Systems, vol. 166, Springer, Berlin, 1979.
[6] E. Draensk, M. Molnrov, Periods of Monge matrices with zero-weight cycles, in: Proceedings
of the Conference on Informatics and Algorithms, Preov, 1998, pp. 327330.
[7] M. Gavalec, Computing matrix period in maxmin algebra, Discrete Appl. Math. 75 (1997) 6370.
[8] M. Gavalec, Reaching matrix period is NP-complete, Tatra Mountains Math. Publ. 12 (1997) 8188.
[9] M. Gavalec, Computing orbit period in maxmin algebra, Discrete Appl. Math. 100 (2000) 4965.
[10] M. Gavalec, Polynomial algorithm for linear matrix period in max-plus algebra, Centr. Eur. J. Oper.
Res. (submitted).
[11] R.M. Karp, A characterization of the minimum cycle mean in a digraph, Discrete Math. 23 (1978)
309311.
[12] L. Jian-Xin, Periodicity of powers of fuzzy matrices (finite fuzzy relations), Fuzzy Sets and Syst. 48
(1992) 365369.
[13] L. Jian-Xin, An upper bound on indices of finite fuzzy relations, Fuzzy Sets and Syst. 49 (1992)
317321.
[14] M. Molnrov, Periods of matrices with zero-weight cycles in max-algebra, Tatra Mountains Math.
Publ. 16 (1999) 135141.
[15] K. Nachtigall, Powers of matrices over an extremal algebra with applications to periodic graphs,
Math. Meth. Oper. Res. 46 (1997) 87102.
[16] M.G. Thomason, Convergence of powers of a fuzzy matrix, J. Math. Anal. Appl. 57 (1977) 476480.
[17] D. Warshall, A theorem on Boolean matrices, J. ACM 9 (1962) 1112.
[18] U. Zimmermann, Linear and combinatorial optimization in ordered algebraic structures, Ann. Discrete Math. 10 (1981).