Set Matrices and The Path/Cycle Problem
Presentation of set matrices and demonstration of their efficiency as a tool using the path/cycle problem.
Authors: Sergey Gubin
SET MA TRICES AND THE P A TH/CYCLE PR OBLEM SERG EY GUBIN Abstract. Presen tation of set matrices and demonstration of their efficiency as a tool using the path/cyc le pr oblem. Introduction Set matrices are matrices whose elements are sets. The matrices co mprise abil- ities of data s to ring and pro cessing . That mak es them a promising com binatorial structure. T o prov e the concept, this w ork applies the matrices to the path/cy cle problem, see [1, 2, 3, 4, 5, 6, 7, 9, 1 0, 1 1, 12, 13, 14, 15, a nd many others]. The problem may be generalized as a problem to find all paths and all cycles of all length in fo r m of vertex pairs (start, finish). That is a NP- ha rd pr oblem beca us e any of its solutions will include a solution o f the Hamiltonian pa th/cycle pro ble ms [5]. This presentation uses set matrices to r ealize the following plan to solve the generalized problem: pres ent the w alk length dynamics with a generative gra mmar, but include in the gr ammar’s pro ductio n rules so me path/cycle filters in order to deplete the resulting walk language to the indicatio n of path/ cycle’s presence/a bsence, only . The desig n’s idea may b e traced back trough the dynamic pr ogra mming, the Ramsey theory , the formal lang uage theory , a nd to the icosia n calculus [16, 17]. Realization of the design requir es to maint ain a set of visited/unvisited vertices and to use that set as a filter in pro duction of the next generation of walks. Set matrices sa tisfy the requirements. Sorting/facto ring of the visited/unvisited ver- tices in to v ertex pairs (start, finish) creates a set matrix analo g of the adjacency matrix. And the esp ecially designed p owers of the set matrix crea te an analytic path/cycle filter. The path/cycle la nguage’s sp ecification g ets a r ealization in form of the eas y-to-chec k prop erties of the ele ments of the a djacency set matr ix’s p ow- ers. The factoring of the set of visited/unvisited v ertices int o vertex pairs (start, finish) may b e seen as a w alk color ing w he r e co lors are the factor-sets. Then, the family of algorithms rea lizing the des ign can b e para metrized with the following four extreme strategies: to colo r the walks with sets of the visited/unvisited start/finish vertices. W o rk [18] describ es a walk colo ring with the unvisited vertices. This work deploys walk coloring with the vis ited vertices. W ors t case for the a lgorithms is a complete gra ph. F or a complete graph with n vertices, the algorithms p erfor m n iter ations and, on ea ch o f these iterations, O ( n 2 )-time pro cessing for ea ch o f the n 2 vertex pair s. That totals in time O ( n 5 ) needed for the a lg orithms to find all paths and all cy cles o f all leng th in the form of vertex pairs (start, finish). Date : Septe mber 17, 2007. 2000 Mathematics Subje ct Classific ation. Prim ar y 05C38, Secondary 68R10. 1 2 SERGEY GUBIN 1. Set Ma trices Let V be a universal set. Set ma tr ices a re matrices whose elemen ts a re s e ts. All set opera tions can b e defined on the set matrices. F or example, if A = ( a ij ) and B = ( b ij ) ar e set matrices of the a ppropriate sizes , then Complim en t: A c = ( a c ij ); Join: A ∪ B = ( a ij ∪ b ij ); In tersection: A ∩ B = ( a ij ∩ b ij ) , Multipli cation: AB = ( [ µ a iµ × b µj ) , - where “ × ” is Cartesian pro duct o f sets, etc. Mo re o p erations can be found in [18]. F or the path/cycle problem, the most in teresting ope r ation is the s et matrix m ultiplication. The op eration can b e redefined in different w a ys. In this pres en- tation, let us use the following multiplication: for set matrices A = ( a ij ) n × m and B = ( b ij ) m × k , pro duct AB is the n × k set matrix who se elements are (1.1) ( AB ) ij = T n µ =1 a iµ ∪ b µj , i 6 = j V , i = j Here and further, symbol ( X ) ij means ( i, j )-elemen t of matrix X . F or m ula 1.1 is the formula of the num ber matrix m ultiplication, except “+ ” is replaced with “ ∩ ”, “ × ” is r eplaced with “ ∪ ”, and some specia l cases are taken care of. The special cases treatment makes multiplication 1.1 a no n-asso cia tive op eration: Exercise 1.1. [ ∅ ∅ ∅ { a } ∅ ∅ ∅ { b } ] ∅ { c } = V ∅ ∅ V ∅ { c } = V ∅ , ∅ ∅ ∅ { a } [ ∅ ∅ ∅ { b } ∅ { c } ] = ∅ ∅ ∅ { a } V ∅ = V { a } . Let A b e a squar e set ma trix. The following iteratio ns define the left and rig ht k -th p ow ers of the matrix, k ≥ 1: (1.2) R 1 = T 1 = A ( R k +1 ) ij = T µ ( R 1 ) iµ ∪ ( R k ) µj , i 6 = j V , i = j ( T k +1 ) ij = T µ ( T k ) iµ ∪ ( T 1 ) µj , i 6 = j V , i = j Let us estimate the computationa l complexity of formula 1.2. Multiplication 1.1 requires O ( n 3 ) op erations “ ∪ ” and “ ∩ ”. Thus, if t k − 1 is the num ber of op eratio ns needed to calculate ( k − 1)-th p ower, then the n um ber of op era tions needed to calculate k -th p ower is t k = t k − 1 + O ( n 3 ) = O ( k n 3 ) . SET MA TRICES AND THE P A TH/CYCLE PROBLEM 3 Thu s, the time needed to calculate k -th p ow er ca n b e es timated as (1.3) O ( k n 3 | V | ) . The list of set matrix o p erations and prop er ties ca n b e contin ued. But let us sta r t and demonstrate some b enefits. 2. P a th pr oblem Let g = ( V , A ) b e a given (multi) dig raph: V is the v ertex set and A is the a rc set of g . Let the vertex set V b e the universal set. Let’s en umerate it: V = { v 1 , v 2 , . . . , v n } . Let G b e the a djacency matrix of g appropr iate to this enumeration. Then the po sitive elements of powers of G indicate the pr esence of walks: vertex pairs (start, finish) of k -w alks are indexes o f po sitive elements of matrix G k . The powers of this adjacency matr ix ca n detect a shortest path but not a path of a sp ec ific length. Also, calculating the p ow ers inv olv es ma g nitudes of O ( n k − 1 (max ij ( G ) ij ) k ) . Although, the last problem can b e solved with the Bo olea n adjacency matrices [18]. Let T b e the following se t matrix of size n × n : (2.1) ( T ) ij = { v j } , ( G ) ij > 0 ∧ i 6 = j V , ( G ) ij ≤ 0 ∨ i = j Matrix T may b e seen as an adjacency set matrix. Let T k be the k -th rig ht p ow er of matrix T , defined with for mulas 1.2. Lemma 2.1. In digr aph g for k < n , if set ( T k ) ij 6 = V , then the set is e qu al to ( T k ) ij = \ µ { v µ 1 , v µ 2 , . . . , v µ k − 1 , v µ k } , wher e the int erse ct ion is taken over al l or der e d numb er samples µ = ( µ 1 , µ 2 , . . . , µ k − 1 , µ k ) which satisfy t he fol lowing c onst r ai ns: 1 ≤ µ x ≤ n, x = 1 , 2 , . . . , k ( v i , v µ 1 ) ∈ A, ( v µ x , v µ x +1 ) ∈ A, x = 1 , 2 , . . . , k − 1 µ x 6 = i, x = 1 , 2 , . . . , k µ k = j µ x 6 = µ y ⇔ x 6 = y - wher e set A is the ar c set of dig r aph g . Pr o of. Due to definitions 1 .2 and 2 .1, if ( T k ) ij = \ µ ( T 1 ) iµ 1 ∪ ( T 1 ) µ 1 µ 2 ∪ . . . ∪ ( T 1 ) µ k − 2 µ k − 1 ∪ ( T 1 ) µ k − 1 µ k 6 = V , then there a r e num ber samples µ = ( µ 1 , µ 2 , . . . , µ k − 1 , µ k ) which satisfy the fir st four constr a ins, and (2.2) ( T k ) ij = \ µ { v µ 1 } ∪ { v µ 2 } ∪ . . . ∪ { v µ k − 1 } ∪ { v µ k } , 4 SERGEY GUBIN where the intersection is taken ov er all those num ber samples. Proving the last constrain will prov e the lemma. T o do so, let’s use mathematical induction ov er k . F or k = 1, due to definitions 1.2 and 2.1, ( T 1 ) ij 6 = V iff there are ar cs from vertex v i int o vertex v j and the arcs are not lo o ps ( i 6 = j ). Then, ( T 1 ) ij = { v j } and ( v i , v j ) ∈ A . Thu s, the lemma holds for k = 1. Because of an irreg ula rity in the p owers definition, the induction ha s to start from k = 2. In this cas e , due to definitions 1.2 a nd 2.1, if ( T k ) ij = \ γ ( T 1 ) iγ ∪ ( T 1 ) γ j 6 = V , then there a re such indexes γ that ( T k ) ij = \ i 6 = γ , γ 6 = j, i 6 = j, ( v i ,v γ ) ∈ A, ( v γ ,v j ) ∈ A { v γ , v j } , where A is the a rc set o f digra ph g . Th us, the lemma holds for k = 2. Let’s as s ume that the lemma holds fo r all k ≤ m − 1 < n − 1, and let ( T m ) ij 6 = V . Then, due to decomp os itio n 2.2, ( T m ) ij = \ µ { v µ 1 } ∪ { v µ 2 } ∪ . . . ∪ { v µ m − 1 } ∪ { v µ m } 6 = V , where the intersection is taken over some num ber samples µ , satisfying the first four constr a ins. Then, there is such num ber sample µ that { v µ 1 } ∪ { v µ 2 } ∪ . . . ∪ { v µ m − 1 } ∪ { v µ m } = Z 6 = V . Then, due to decompo sition 2 .2, for any o f suc h n um ber samples µ , the following holds: ( T m − 1 ) iµ m − 1 ⊆ { v µ 1 } ∪ { v µ 2 } ∪ . . . ∪ { v µ m − 1 } ⊆ Z 6 = V , and ( T m − 1 ) µ 1 µ m ⊆ { v µ 2 } ∪ { v µ 3 } ∪ . . . ∪ { v µ m } ⊆ Z 6 = V . Then, due to the induction hypothes is, b oth num ber samples ( µ 1 , µ 2 , . . . , µ m − 2 , µ m − 1 ) and ( µ 2 , µ 3 , . . . , µ m − 1 , µ m ) satisfy all five constra ins. Particularly , µ x 6 = µ y , ⇔ x 6 = y , x, y = 1 , 2 , . . . , m − 1; µ x 6 = µ y , ⇔ x 6 = y , x, y = 2 , 3 , . . . , m ; and, due to the third constra in for ( T m − 1 ) µ 1 µ m 6 = V , µ 1 6 = µ m = j. Thu s, the whole num ber sample µ satis fie s the fifth constr ain. That concludes the induction and pr ov es the lemma for all k < n . Lemma 2 .1 allows the following interpretation: Lemma 2.2. In digr ap h g , if ( T k ) ij 6 = V , then ther e is a k -p ath fr om vert ex v i into vertex v j . Pr o of. The constr a ins in lemma 2.1 are the definition o f a path from v i int o v j . SET MA TRICES AND THE P A TH/CYCLE PROBLEM 5 Lemmas 2.1 and 2 .2 show that matrices T k collect the v ertex-bridges . That may be interesting for the graph toughnes s theory [6, 15]. Lemma 2 .3. In digr ap h g , if ther e is a k - p ath fr om vertex v i into vertex v j then ( T k ) ij 6 = V . Pr o of. Let the following v ertices constitute a k -path from vertex v i int o vertex v j : v µ 1 = i , v µ 2 , . . . , v µ k +1 = j . Indexes of these v ertices satisfy the constrains in lemma 2.1. Then, due to defini- tions 1.2 and 2.1, ( T k ) ij = \ µ ( T 1 ) iµ 1 ∪ ( T 1 ) µ 1 µ 2 ∪ . . . ∪ ( T 1 ) µ k − 2 µ k − 1 ∪ ( T 1 ) µ k − 1 µ k ⊆ ⊆ { v µ 1 } ∪ { v µ 2 } ∪ . . . ∪ { v µ k } ∪ { v µ k +1 } ⊆ V − { v i } 6 = V . Theorem 2 .4. In digr aph g for k ≥ 1 , t her e ar e k -p aths fr om vertex v i into vertex v j iff ( T k ) ij 6 = V . Pr o of. The theorem ag grega tes lemmas 2.2 and 2.3. Let us notice that case k ≥ n is cov ered b y lemmas 2.1 and 2 .3: k ≥ n ⇒ T k = ( V ) n × n . Estimation 1.3 sho ws the computationa l complexity to detect the k -paths with theorem 2.4. P articularly , when k = n − 1 , the theor em detects the exis tence or absence of Hamilto nian paths in time O ( n 5 ) . All the results ca n b e r ep eated with the left p ow ers of matrix T . Also, definition 2.1 uses the a rc finish vertices. Obviously , the results can b e r e pe a ted with the start vertices using the following set ma trix ins tea d of ma trix 2.1: (2.3) ( R ) ij = { v i } , ( G ) ij > 0 ∧ i 6 = j V , ( G ) ij ≤ 0 ∨ i = j Colorings 2.1 a nd 2.3 cover tw o of the four extreme strateg ies of walk coloring : to color w alks with the v isited start/finish v ertices. Another t w o ex treme strategies are discussed in [18]. They pr o duce the sa me results but in ter ms of the compliment sets. 3. Cycle problem Obviously , the solution of the path problem described in sec tio n 2 solves the cycle problem, as well. Let us forma lize that analytica lly . Let’s define another set matrix mult iplication: if A a nd B are set matr ices of appropria te sizes, then (3.1) ( AB ) ij = T ν ( A ) iν ∪ ( B ) ν j , i = j V , i 6 = j 6 SERGEY GUBIN And let us define the following walk colo ring: ( S ) ij = { “Lo op” } , ( G ) ij > 0 ∧ i = j V , ( G ) ij ≤ 0 ∨ i 6 = j , (3.2) S 1 = S, S k +1 = T k R 1 , k ≥ 1 , - where set matrices T k and R 1 were defined in section 2, and matrix mult iplication 3.1 is us e d. Theorem 3.1. In digr aph g for k ≥ 1 , ther e ar e k -cycles attache d to vertex v i iff ( S k ) ii 6 = V . Pr o of. Case when k = 1 is obvious. Le t k > 1 . Necessity . Let a k -cycle be attached to v ertex v i , a nd let the cycle visit the following vertices in the order s hown: v µ 1 = i , v µ 2 , . . . , v µ k , v µ k +1 = i . Then, the last k v ertices in the row constitute a ( k − 1)-pa th fr om v µ 2 int o v i . Thus, due to lemma 2.1 a nd theorem 2.4, v i ∈ ( T k − 1 ) µ 2 i 6 = V . On the o ther hand, due to definition 2.3, ( R 1 ) iµ 2 = { v i } 6 = V . Thu s, due to definition 3 .1, ( S k ) ii = (( T k − 1 ) µ 2 i ∪ { v i } ) ∩ . . . ⊆ ( T k − 1 ) µ 2 i ∪ { v i } = ( T k − 1 ) µ 2 i 6 = V . Sufficiency . Let ( S k ) ii = \ ν ( T k − 1 ) iν ∪ ( R 1 ) ν i 6 = V . Then, there is such num b er ν that ( T k − 1 ) iν ∪ ( R 1 ) ν i 6 = V . Then, due to theo rem 2 .4, there is a ( k − 1)-path fr om v i int o v ν ; and, due to definition 2.3, there is an arc from v ν int o v i . The path a nd arc create a k -c ycle attached to v i . Estimation 1.3 gives the computational complexity of theo rem 3.1. Particularly , when k = n , the theo rem detects the existence/a bsence of Hamiltonian cycles in time O ( n 5 ). But some simplifica tions a re po ssible. The existence/ absence of Hamiltonian cycles can be detected by only c a lculating any one string o f matrix T n − 1 . That r educes the time needed to solve the Hamiltonian cycle problem to O ( n 4 ) . SET MA TRICES AND THE P A TH/CYCLE PROBLEM 7 Conclusion The pap er presented set matrices as an efficient to ol for s olving the co mbin atorial problems. The matrices were used to solve the path/cycle pro blem in polynomial time: k -path: Calculate set matrix T k with formulas 2.1 and 1.2. Use theorem 2.4 to detect all k -paths in form vertex pair (start, finish); k -cycle: Calculate set matrix S k with for mulas 2.1, 1.2, 2.3, 3.1, and 3.2. Use theorem 3.1 to detect all vertices which hav e a k -cycle attached. Bo olean prop erty “It is equal to the vertex set” o f the elements of ma trices T k and S k fulfill the path/cycle langua ge’s sp ecifica tion: indicate the pr esence/abse nc e of paths/cycles. F or a graph with n vertices, it will take O ( n 5 )-time to write down the whole languag e in form of O ( n ) matrices of size n × n filled with 1 and 0: 1 will mean the ex istence of appropria te paths/cycles and 0 will mean their a bs ence. References [1] W.T. T utte. On Hamiltonian Circuits. J. London Math. Soc. 21, 98-101, 1946. [2] W.T. T utte. A Theorem on Planar Graphs. T rans. Amer. Math. Soc. 82(1956), 99-119. [3] O.A. Ore. A note on Hamiltonian Circuits. Amer. Math. Mon thly . 67(196 0), 55. [4] Stephen Cook. The complexit y of theorem-proving pro cedures. In Conference Record of Third Ann ual ACM Symp osium on Theory of Computing, 151-158, 1971 [5] Richard M. Karp. Reducibili t y among com binatorial problems. In R.E. Mil ler and J.W. Thatc her, editors, Complexity of Computer Computations, 85-103, New Y ork, 1972 Pl en um Press. [6] Chv atal, V aclav. T ough graphs and Hamiltonian cir cuits. D i screte Mathematics 5 (3): 215228, 1973 [7] H.A. Jung. On Maximal Cir cuits in Finite Graphs. Annals of Discrete Math 3(1978) , 129-144. [8] B. Bollabas and A.M. Hobbs. Hamiltonian cycles. Adv ance s in Graph Theory . (B. Bol l abas ed) N orth-Holland Publ., Amsterdam, 1978, 43-48. [9] M.R. Garey and D. S. Johnson. Computers and Int ractabilit y , a Guide to the Theory of NP- Completeness. W.H. F r eeman and Co,. San F r ancisco, 1979. [10] G.H. F an. A new Sufficient Condition for cycles i n graphs. J. Combinat. Theory B37(1984) 221-227. [11] Mihalis Y annak akis. Expressi ng combinatorial optimization problems by li near programs. In Pro c. of the t w en tieth ann ual A CM Symp os. on Theory of computing. Chicago, Illinois, 223 - 228, 1988. [12] D. Bauer, E. Sc hmeic hel, and H. J. V eldman. Some Recent Results on Long Cycles in T ough Graphs. Off Prints from Graph Theory , Combinatorics, and Applications. Ed. Y. A lavi, G. Chartrand, O . R. Ollerman, A.J. Sch w enk. John Wiley and Sons, Inc. 1991. [13] R. Diestel. Graph Theory . N ew Y or k, Springer, 1997. [14] The T rav eling Salesman Problem and Its V ar iations. Gregory Gutin and Abraham P . Punnen (Eds.). K luw er Academic Publishers, 2002. [15] Bauer, Douglas; Br oer s ma, Ha j o; Schmeic hel, Edw ard. T oughness in graphs a surv ey . Graphs and Com binatorics 22 (1): 135, 2006. [16] Hamilton, Willi am Ro w an. Memorandum resp ecting a new system of ro ots of unity . Philo- sophical Magazine, 12 1856 [17] Hamilton, Willi am Row an. Accoun t of the Icosian Calculus. Pro ceedings of the Roy al Irish Academ y , 6 1858 [18] Sergey Gubin. Finding paths and cycles in graphs. E-print arXiv:0709.0974, arXiv.org, 2007 Genesys Telecommun ica tion Labora tories, In c. Curr ent addr ess : 1255 T reat Blvd., W alnut Creek, CA 94596 E-mail addr ess : sgubin@g enesysla b.com
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment