Technická univerzita Košice monika.molnarova@tuke.sk
Outline 1 Digraphs Maximum cycle-mean and transitive closures of a matrix Reducible and irreducible matrices Definite matrices
Digraphs Complete digraph Transition matrix of a DDS A = 1 4 ε ε 2 5 6 ε 3 complete digraph G c (A) corresponding finite digraph G(A) 3 3 ε 6 5 ε 1 4 2 1 ε 2 3 3 6 5 1 4 2 1 2
Digraphs Finite digraph Definition For a matrix A R (n, n) we define the digraf G(A) = (V, E) with the node set V = {1, 2,..., n} and with arc (i, j) having finite weight a ij. For any pair (i, j) with a ij = ε, there is no arc from the node i to the node j in the digraph G(A).
Digraphs Paths and cycles Definition A path in a digraph G(A) = (V, E) is a sequence of nodes p = (i 1, i 2,..., i r+1 ) with r 0, such that (i t, i t+1 ) E for any t {1, 2,..., r}. The number r is called the length of p and is denoted by p. If i 1 = i r+1, then p is called a cycle. An elementary path is a path without repetitions. An elementary cycle is a path with only repetition i 1 = i r+1.
Digraphs Weight of a path Definition The weight of a path (cycle) denoted by w(p) (w(c)) is the sum of the weights of its arcs. For a cycle c with positive length the ratio of the weight of the cycle to its length is the mean value of the cycle w(c). The maximum cycle-mean value in G(A) is denoted by λ(a). A cycle with mean value equal to λ(a) is called a critical cycle. Remark: The cycle-mean value of a cycle can not exceed the cycle-means of its elementary cycles. Since a digraph contains finite number of cycles λ(a) always exists. In case there is no cycle with positive length in the digraph λ(a) = ε.
Digraphs Maximum cycle-mean - Example Example: A = 1 4 ε ε 2 5 6 ε 3 3 3 6 5 1 4 2 1 2 c = (1, 2, 3, 1) w(c) = 15 c = 3 λ(a) = w(c) = w(c) c = 5
Digraphs A digraph for A F (n, n) Theorem Let A F (n, n). Then the corresponding digraph G(A) contains at least one cycle with finite weight. P: There is an arc from any node to some node in the digraph G(A). Since the number of nodes is finite a repetition of some node must occur.
Digraphs Maximum weight of paths Theorem Let A R (n, n). The maximum weight of the weights of all paths of length r from a node i to a node j is given by a (r) ij for r = 1, 2,.... P: consider paths p = (i, k, j) of length 2 from the node i to the node j max{a ik + a kj } = k aik a kj = a (2) ij
Maximum cycle-mean and transitive closures of a matrix Weak transitive closure of a matrix Definition Let A R (n, n). The weak transitive closure of the matrix A in max-plus algebra is the sum of its powers (A) = A A 2 A 3 Remark: If (A) = (δ ij ), then δ ij represents the maximum weight of all paths from the node i to the node j regardless of the length.
Maximum cycle-mean and transitive closures of a matrix Maximum speed of DDS - estimation Theorem Let A R (n, n). Suppose the digraph G(A) contains a critical cycle of length L. Then for arbitrary vector x F (n, 1) and t 1 holds ξ(x, A Lt x) (λ(a)) Lt P: c is a critical cycle of length L max a (L) i ii = (λ(a)) L ξ(x(1), C t x(1)) ( set C = A L i cii ) t
Maximum cycle-mean and transitive closures of a matrix Maximum speed of DDS - Example Example: A = 1 4 ε ε 2 5 6 ε 3 3 3 6 5 1 4 2 1 2 c = (1, 2, 3, 1) w(c) = 15 c = 3 λ(a) = w(c) = w(c) c = 5
Maximum cycle-mean and transitive closures of a matrix Maximum speed of DDS - Example x(r) : 1 2 3, 6 8 7, 12 12 12, 16 17 18, 21 23 22 27 27 27 ξ(x(1), x(4)) (λ(a)) 3 = 5 3 = 15 ξ(x(2), x(5)) (λ(a)) 3 = 5 3 = 15...
Maximum cycle-mean and transitive closures of a matrix Nodes of a critical cycle Theorem Let A R (n, n). Let G(A) contains a critical cycle of length L c = (i 1, i 2,..., i L, i 1 ). Then for all multiples q of number L (by natural number) following holds a (q) i si s = (λ(a)) q s = 1, 2,..., L P: the mean value of any cycle is less or equal to maximum cycle-mean (λ(a)) q a (q) i si s q is a multiple of L, we can add proper number of cycles c to get the length q (λ(a)) q a (q) i si s
Maximum cycle-mean and transitive closures of a matrix Nodes of a critical cycle - Example 1 Example: A = 1 4 ε ε 2 5 6 ε 3 3 3 6 5 1 4 2 1 2 the critical cycle c = (1, 2, 3, 1) contains all nodes a (3) ii = (λ(a)) 3 = 5 3 = 15 i = 1, 2, 3 A 3 = 15 8 12 14 15 11 12 13 15
Maximum cycle-mean and transitive closures of a matrix Nodes of a critical cycle - Example 2 Example: A = 1 1 ε ε 2 2 3 ε 4 3 4 3 2 1 1 2 1 2 critical cycle c = (3, 3) A 2 = a (k) 2 3 3 5 4 6 7 4 8 33 = (λ(a))k = 4 k k = 1, 2,... 6 5 7, A 3 = 9 6 10, A 4 = 11 8 12 10 7 11 13 10 14... 15 12 16
Maximum cycle-mean and transitive closures of a matrix p-regularity Definition Let A R (n, n). Let p = A A 2 A 3 A p. The matrix A is called p-regular in max-plus algebra, if (A) = p = p+1 = p+2 =... Theorem Let A R (n, n). Then the following hold 1 If λ(a) 0, then there exists p n, such that the matrix A is p-regular. 2 If λ(a) > 0, then for any p the matrix A is not p-regular.
Maximum cycle-mean and transitive closures of a matrix p-regularity - Example 1 Example: A = 1 1 ε ε 2 2 3 ε 4 3 4 3 2 1 1 2 1 2 critical cycle c = (3, 3) a 33 = λ(a) = 4 14 11 15 A 5 = 17 14 18, A 6 = 19 16 20 18 15 19 21 18 22, A 7 = 26 20 24 22 19 23 25 22 26... 27 24 28
Maximum cycle-mean and transitive closures of a matrix p-regularity - Example 2 Example: A = 5 5 ε ε 4 4 3 ε 2 3 2 3 4 5 1 2 5 4 critical cycle c = (3, 3) a 33 = λ(a) = 2 10 9 9 12 13 11 14 17 13 A 2 = 7 8 6A 3 = 9 12 8 A 4 = 11 14 10 5 8 4 7 10 6 9 12 8
Maximum cycle-mean and transitive closures of a matrix p-regularity - Example 3 Example: A = 3 3 ε ε 2 2 1 ε 0 3 0 1 2 3 1 2 3 2 critical cycle c = (3, 3) a 33 = λ(a) = 0 6 5 5 6 7 5 6 9 5 A 2 = 3 4 2, A 3 = 3 6 2, A 4 = 3 6 2 1 4 0 1 4 0 1 4 0 A 4 = A 5 = A 6...
Maximum cycle-mean and transitive closures of a matrix Strong transitive closure Definition Let A R (n, n). The strong transitive closure of the matrix A in max-plus algebra is the sum Γ(A) = E A A 2 A 3 Remark: Γ(A) = E (A) no action = Γ(D) = E = diagonal elements equal 0 zero profit (loss) ln 1, i.e. logarithm of probability of certain event...
Maximum cycle-mean and transitive closures of a matrix Model of road net-work - probability of accessibility Description of the model: Let us consider a road net-work in a mountain region. Roads connect villages N 1, N 2,... N n. Let p ij represents the probability that the direct road from village N i to village N j is open during the winter. Let us compute the probability of most reliable route from the village N i to the village N j. Solution route (N i, N i+1,..., N j 1, N j ) probability of reliability p i,i+1 p j 1,j
Maximum cycle-mean and transitive closures of a matrix Model of road net-work - probability of accessibility Transformation to max-plus model: ln(p i,i+1 p j 1,j ) = ln p i,i+1 + + ln p j 1,j Solution: set a ij = ln p ij find Γ(A) = γ ij represents probability of most reliable route (logaritmus) γ ii = ln 1 = 0 access of the village N i from itself is guaranteed
Maximum cycle-mean and transitive closures of a matrix Properties of Γ(D) Theorem Let D R (n, n). Let D be p-regular for some p 1, then the strong transitive closure exists. Moreover Γ(D) = (E D) p. P: binomial theorem Γ(D) = E D D 2 D 3 D p = (E D) p
Maximum cycle-mean and transitive closures of a matrix Computation of strong transitive closure - method of matrix squaring Theorem Let D R (n, n). Let λ(d) 0. Then the following holds D n E n 1. P: diagonal elements d (n) ii e ii = 0 (cycle weights) off diagonal elements d (n) ij weights of paths of length n = contain cycle = d (n) ij ( n 1 ) ij Corollary Let D R (n, n). Let λ(d) 0. Then for arbitrary p n 1 holds Γ(D) = (E D) p.
Maximum cycle-mean and transitive closures of a matrix Computation of strong transitive closure - Example Example: Consider matrix D R (16, 16). Let λ(d) 0. Let us compute the strong transitive closure Γ(D). Solution: Γ(D) = (E D) p p n 1 = 15 Γ(D) = (E D) 15 = (E D) 16 = (E D) 24 Theorem Let D R (n, n). Let λ(d) 0. Then Γ(D) can be computed by matrix-squaring method in O(n 3 ln n) time.
Maximum cycle-mean and transitive closures of a matrix Computation of weak transitive closure - Example Example: Consider matrix D R (16, 16). Let λ(d) 0. Let us compute the weak transitive closure (D). Solution: (D) = D Γ(D) = D (E D) 24 Theorem Let D R (n, n). Let λ(d) 0. Then (D) can be computed by matrix-squaring method in O(n 3 ln n) time.
Reducible and irreducible matrices Strong connectivity - Algorithm for verifying by Γ(D) Definition Let D R (n, n). The digraph G(D) is strongly connected, if there is a path from node i to node j for arbitrary pair of distinct nodes i and j. Algorithm for verifying the strong connectivity: assign each arc in the digraph by weight 0 λ(d) 0 = Γ(D) can be computed digraph is strongly connected if all elements of Γ(D) are finite
Reducible and irreducible matrices Verifying the strong connectivity - Example 1 Example: D = Solution: 0 ε 0 0 0 0 ε ε ε 0 0 ε ε ε ε 0 Γ(D) = (E D) 3 = D 3 = D 4 Γ(D) = 0 0 0 0 0 0 0 0 0 0 0 0 ε ε ε 0 0 4 0 0 0 0 1 3 0 0 2 0
Reducible and irreducible matrices Verifying the strong connectivity - Example 2 Example: D = ε ε 0 0 0 ε ε ε ε 0 ε ε ε ε 0 ε 4 0 0 0 1 3 0 0 2 Solution: Γ(D) = Γ(D) = (E D) 3 = (E D) 4 0 ε 0 0 0 0 ε ε ε 0 0 ε ε ε 0 0 4 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Reducible and irreducible matrices Computation of weak transitive closure - Floyd-Warshall algorithm Floyd-Warshallov algorithm For D R (n, n) compute the sequence D {1}, D {2},..., D {n+1} for k = 1, 2,..., n { {k} d ij d {k+1} ij = d {k} ij d {k} ik d {k} kj for i k j k d {k} ij for i = k j = k represents the maximum weight of all elementary paths from the node i to the node j not having as an intermediate node any node r for r k
Reducible and irreducible matrices Computation of weak transitive closure - Floyd-Warshall algorithm Theorem Let D R (n, n). Let λ(d) 0. Then (D) = D {n+1}, which Floyd-Warshall algorithm computes in O(n 3 ) time. Corollary Let D R (n, n). Let λ(d) 0. Then Floyd-Warshall algorithm computes Γ(D) in O(n 3 ) time. P: Γ(D) = E (D)
Reducible and irreducible matrices Floyd-Warshall algorithm - Example Example: D = ε 0 0 0 ε ε 0 ε 0 ε ε 0 ε ε ε ε 4 0 0 0 1 3 0 0 0 2 Solution: D {1} = D D {2} = d {1+1} ij = { ε 0 0 0 ε ε 0 ε 0 0 0 0 ε ε ε ε {1} {1} {1} d ij d i1 d 1j pre i 1 j 1 d {1} ij pre i = 1 j = 1
Reducible and irreducible matrices Floyd-Warshall algorithm - Example D {3} = ε 0 0 0 ε ε 0 ε 0 0 0 0 ε ε ε ε D{4} = (D) = D {5} = D {4} = Γ(D) = E (D) = 0 0 0 0 0 0 0 0 0 0 0 0 ε ε ε ε 0 0 0 0 0 0 0 0 0 0 0 0 ε ε ε ε 0 0 0 0 0 0 0 0 0 0 0 0 ε ε ε 0
Reducible and irreducible matrices Strongly connected components Theorem Let D R (n, n). The digraph G(D) is strongly connected if and only if there is a common cycle for any pair of distinct nodes. Definition Let G(D) = (V, E) is a digraph. A subdigraph K = (K, E K 2 ) generated by a nonempty subset K V satisfying 1 there is a common cycle for any pair of distinct nodes 2 K is the maximum subset with above property is called a strongly connected component of G(D).
Reducible and irreducible matrices Finding the strongly connected components by Γ(D) Algorithm for finding the strongly connected components: 1 choose i and find in i-th row of Γ(D) the finite values δ ij, for which δ ji is finite as well = these nodes are contained in the same strongly connected component 2 remove all the rows and columns corresponding to the nodes of the strongly connected component 3 repeat steps 1 and 2, until all the nodes are associated with one of the strongly connected components
Reducible and irreducible matrices Finding the strongly connected components by Γ(D) - Example D = ε ε ε ε 0 ε 0 ε ε 0 ε ε ε 0 ε ε ε 0 ε ε 0 ε ε ε 0 ε ε ε ε 0 ε ε ε ε ε ε Γ(D) = 0 ε ε ε 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ε ε ε 0 0 ε ε ε ε ε 0 delete 1. and 5. row and column 0 0 0 0 K 1 = {1, 5} 0 0 0 0 0 0 0 0... K 2 = {2, 3, 4} K 3 = {6} ε ε ε 0
Reducible and irreducible matrices Condensed digraph Condensed digraph nodes K 1, K 2, K 3 represent strongly connected components K 3 K 2 K 1 condensed digraph is acyclic
Reducible and irreducible matrices Acyclic digraphs - coherent numbering Definition Digraph which contains no cycles except loops is called acyclic. Definition An acyclic digraph is coherently numbered, if for any arc (i, j) holds i j. Theorem An acyclic digraph can be always coherently numbered.
Reducible and irreducible matrices Coherent numbering of an acyclic digraph Algorithm for coherent numbering of an acyclic digraph: 1 remove loops 2 assign the highest node-numbers to the terminal nodes 3 delete them with all arcs incident with them 4 repeat steps 2-3, until all the nodes are numbered
Reducible and irreducible matrices Coherent numbering of an acyclic digraph - Example 3 2 1 3 1 2
Reducible and irreducible matrices The matrix of a coherent numbered acyclic digraph Example: D = 0 0 0 ε 0 0 ε ε ε 3 1 2 Theorem Let T (n, n) is the class of upper-triangular matrices of order n. Then T (n, n) is closed under and, i.e. A, B T (n, n) 1 A B T (n, n) 2 A B T (n, n)
Reducible and irreducible matrices Irreducible a reducible matrices Definition Let D R (n, n). The matrix D is called irreducible, if G(D) is strongly connected. Matrix D, which is not irreducible is called reducible. Definition The digraph of a reducible matrix is coherently numbered, if for any arc (i, j) for nodes i and j from distinct strongly connected components holds i < j. Remark: The matrix of a coherently numbered acyclic digraph has an upper triangular form. The matrix of a coherently numbered digraph has an upper block-triangular form.
Reducible and irreducible matrices Coherent numbering of an arbitrary digraph K 3 3 K 2 K 1 1 2 K 3 = {6} 3 rd {6} K 1 = {1, 5} 2 nd {4, 5} K 2 = {2, 3, 4} 1 st {1, 2, 3}
Reducible and irreducible matrices Permutation of nodes π = ( 1 2... n π(1) π(2)... π(n) ) ( 1 2 3 4 5 6 = 4 1 2 3 5 6 permutation matrix P P 1 : P P 1 = P 1 P = E P = ε ε ε 0 ε ε 0 ε ε ε ε ε ε 0 ε ε ε ε ε ε 0 ε ε ε ε ε ε ε 0 ε ε ε ε ε ε 0 P 1 = ) ε 0 ε ε ε ε ε ε 0 ε ε ε ε ε ε 0 ε ε 0 ε ε ε ε ε ε ε ε ε 0 ε ε ε ε ε ε 0 D com = P 1 D P
Reducible and irreducible matrices The matrix of a coherent numbered digraph D = Γ(D) = ε ε ε ε 0 ε 0 ε ε 0 ε ε ε 0 ε ε ε 0 ε ε 0 ε ε ε 0 ε ε ε ε 0 ε ε ε ε ε ε 0 ε ε ε 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ε ε ε 0 0 ε ε ε ε ε 0 D com = Γ(D com ) = ε ε 0 0 ε ε 0 ε ε ε ε 0 ε 0 ε ε ε ε ε ε ε ε 0 ε ε ε ε 0 ε 0 ε ε ε ε ε ε 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ε ε ε 0 0 0 ε ε ε 0 0 0 ε ε ε ε ε 0
Reducible and irreducible matrices The upper block-triangular matrix The upper block-triangular matrix D com = D 11 D 12 D 13 ε D 22 D 23 ε ε D 33 = ε ε 0 0 ε ε 0 ε ε ε ε 0 ε 0 ε ε ε ε ε ε ε ε 0 ε ε ε ε 0 ε 0 ε ε ε ε ε ε
Reducible and irreducible matrices Floyd-Warshall algorithm - summary By Floyd-Warshall algorithm we can in O(n 3 ) time 1 find the strongly connected components 2 number coherently the nodes 3 find the upper block-triangular matrix
Definite matrices Definite matrices Definition Let D R (n, n). A node j of a critical cycle in G(D) is called an eigen node. Definition Let D R (n, n). The matrix D is called definite, if 1 λ(d) = 0 2 G(D) is strongly connected
Definite matrices Definite matrices - summary Theorem Let D R (n, n) is definite with digraph G(D). Then 1 D F (n, n), (D) exists and is finite (if n > 1) and δ ij for i j represents some maximum weight path from node i to node j of length not exceeding n 1 2 each diagonal element δ ii represents some maximum weight cycle containing node i of length not exceeding n 3 G(D) contains at least one elementary cycle with weight 0 and no cycle with positive weight 4 G(D) contains at least one eigen-node, for any eigen node j is δ jj = 0, else δ kk < 0
Definite matrices Eigen nodes of a definite matrix Theorem Let D F (n, n) is definite and = (D). If j is an eigen node then for any node i there is a node k such that δ ij = d ik + δ kj. Theorem Let D F (n, n) is definite and = (D). For any node j there is an eigen node i such that δ ij represents the weight of some path from the node i to the node j of length n + 1. Theorem Let D F (n, n) is definite, then λ(d p ) = 0 (for p > 1) and G(D) and G(D p ) have the same eigen nodes.
Definite matrices Transitive closures of definite matrices with increasing property Theorem Let D R (n, n). Then the DES with the transition matrix D has the increasing property if and only if D E, and then D F (n, n). If D is definite and DES has the increasing property, then 1 d ii = 0 i = 1, 2,..., n 2 Γ(D) = D n 1 = (D), and D (D) = (D)
Thank you for your attention.