SEQUENTIAL ALGORITHMS OF GRAPH NODES FACTORIZATION
Tsitsiashvili G.Sh.
IAM FEB RAS 690041 Russia, Vladivostok, Radio str. 7, IAM FEB RAS e-mail: [email protected]
In this paper algorithms of a factorization of graph nodes which are used in a processing of data connected with different extreme situations are constructed. We assume that information about a new node and incident edges arrives at each step sequentially. In non oriented graph we suppose that two nodes are equivalent if there is a way between them. In oriented graph we assume that two nodes are equivalent if there is a cycle which includes these nodes. In this paper algorithms of such factorization are constructed. These algorithms need o(n2) arithmetic operations where n is a number of graph nodes.
1. Factorization of nodes in non oriented graph
Two nodes of a non oriented graph belong to a same connectivity component (are equivalent [1,§3]), if in the graph there is a way which connects these nodes.
1. On the step 1 we put that there is the single node 1 and the number of connectivity components equals q = 1 and the connectivity component K1 = {1}.
2. Assume that on the step n there are nodes 1,...,n; and q < n connectivity componentsK1,...,Kq
q , . k, nK. = 0, i * j, u Kt = {1,...,n}.
i=1
3. On the step n +1 we receive an information about a. ,1 < j < n : a. = 1, if the nodes n +1, j are connected by (non oriented) edge, in opposite case a. = 0. Calculate c. = v a., 1 <i < q, using n
jeKt
arithmetic operations.
4. Define the indexes set I = {i: ct = 1}={i0, i1,...,ir}, 1 < t0 < , <... < tr < q, using no more than n arithmetic operations.
5. From the sequence {i0 + 1,...,i1 -1,i1 + 1,...,i2 -1,i2 + 1, . ,ir-1,ir + 1, . ,q} with q-i0 integers remove the numbers i1,...,ir and transform it into the sequence with q -i0 -r integers {i0 + 1,...,i1 -1, i1 + 1,...,i2-1, i2 + 1,...,ir-1, ir +1,..., q}={/(i0 + 1),...,/(q - r )}using no more than n arithmetic operations.
6. Assume that I ¿0 then put Kt := Kt , 1 < i < i0 , K0 = {n +1} U
Uk,
JEI
K, := K
1 (,),
i0 +1 < i < q - r , q := q - r , using no more than n arithmetic operations.
If I e0 then put Kq+1:={n +1}, q := q +1 using 2 arithmetic operations. Consequently the
transformation of the connectivity components set on the step n +1 needs no more then 4n aarithmetic operations for the non oriented graph. So the calculation complexity of suggested algorithm on n steps is no more then 2n2 aarithmetic operations.
2. Factorization of nodes in oriented graph
Say that two nodes of an oriented graph are equivalent [1,§3] if there is a cycle which contains them. It is obvious that this binary relation is reflexive, symmetric and transitive and so is a relation of equivalence on the set of nodes of the oriented graph. On the set of equivalence classes introduce
the following binary relation: pyq if in the initial graph there is a way from any node of the class p to any node of the class q. It is clear that this binary relation is reflexive, transitive and anti symmetric and so is a relation of a partial order. [1,§4]. Then we contrast to this relation a zero-one matrix in which in the cell (p, q) there is 1 if pyq and 0 in other cases.
We suggest the following sequential algorithm of the oriented graph nodes factorization. On the first step we have a single node which is in the single cluster. The matrix a of the partial order here consists of the single unit. Assume that on the n -the step there is the set I of clusters and the one-zero matrix a which characterizes the relation of the partial order y between them. On the step n +1 new node n +1 and two edges appear. One of these edges runs into the cluster p and another runs from the cluster q into the node n +1. Then new clusters and the partial order matrix a are constructed as follows. Denote
Kp={k e In : pyk) , Rq = {k e In : kyq), (1)
A = Kp n Rq, A1 = Kp \ A, A2 = Rq \ A, B = I \ (A U A U A2). (2)
The new node n +1 and the clusters from the set A form new cluster (n +1). The matrix a is
divided into 16 rectangular boxes which are created by the cluster n +1 and the sets of clusters A1,
A2, B. To describe these boxes introduce auxiliary designations A of a sub matrix which coincides
with analogous sub matrix in previous version of a , e is a sub matrix consisting of units and o is a sub matrix consisting of zeros. In a cell "... ^..." of a left set "..." is a vector-column and right set"..." is
a vector-string consisting of clusters. The matrix a contains the following cells:
1. (n +1) ^ (n +1) which has the form e because (n +1) is the cluster;
2. (n +1)^ A1 has the form e by a definition of the clusters set A1;
3. A2 ^(n +1) has the form e by a definition of the clusters set A2;
4. A2 ^ A1 has the form e because in the graph on the step n+1 there is a way from a cluster j e A2 to a cluster i e A1 which passes through the node n +1;
5. A1 ^(n+1) has the form o because in opposite case a part of clusters fromA1 joins the set A;
6. (n+1)^ A2 has the form o because in opposite case a part of clusters from the set A2 joins the set A ;
7. A1 ^ A2 has the form o because in opposite case a part of clusters from the sets A1, A2 joins the set A0;
8. (n +1) ^ B has the form obecause in opposite case a part of clusters from the setB joins the set A1;
9. B ^ (n +1) has the form o because in opposite case a part of clusters from the setB joins the set
a2;
10. A1 ^ B has the form o because in opposite case a part of clusters from the setB joins the set A1;
11. B ^ A2 has the form o because in opposite case a part of clusters from the setB joins the set
a2;
12. B ^ B has the form A because in opposite case a way
i ^k1 ^k2 ^ j ^(n +1)^i, i e A1, j e A2, k1 e B,k2 eB appears and so the clusters k1,k2 e B;
Tsitsiashvili G.SH.- SEQUENCE SEQUENTIAL ALGORITHMS OF GRAPH NODES FACTORIZATION , n, RT&AT# 04
(Vol.8) 2013, December
13. A1 ^ A1 has the form A because in opposite case a way i ^ k ^{n +1), i e A1, k e B , j e A2 appears and so k e A1 f| A2;
14. A2 ^ A2 has the form A because in opposite case a way i ^ k ^{n +1), i e A1, k e B , j e A2 appears and so k e A1 f| A2;
15. B ^ A1 has the form A because in opposite case a way k ^ j ^{n +1) ^ i, i e A1, k e B , j e A2 appears and so k e A2;
16. A2 ^ B has the form A because in opposite case a way k ^ i ^{n +1)^ j, i e A1, k e B , j e A2 appears and so ke A1 .
The transformation of the matrix a on the transition from the step n to the step n +1 needs the sets A, A1, A2, B definition by the formulas (1), (2) and demands O{n) arithmetic operations and O {n2) operations of an assignment. Consequently a calculation of the connectivity components and of the partial order matrix up to the step n demands o{n2) arithmetic operations and O {n3) assignment operations.
Remark 1. This solution remains correct if the single edge from the node n +1 is replaced by a few edges and the single edge to the node n +1 is replaced by a few edges also. Numbers of these additional edges is no more than some finite m which does not depend on n. Denote by P the set of clusters in which new edges come into and by Q the set of clusters from which new edges come
into the node n +1. Then the sets A, A1, A2, B are defined as follows. Assume that
Kp={k e In : pyk}, p e P, Rq = {k e In : kyq}, q e Q , K' = U Kp, R = U Rq, A = K n R'.
peP qeQ
New node n +1 and clusters from the set A create new cluster which we denote by {n +1) and put
A1 := K' \ A, A2 := R' \ A, B := I \ {A U A1 U A2), I := IU n +1.
Describe now an algorithm of a construction of the clusters set and the matrix of partial order on this set in general case. On the step 1 there is the single node 1, the set of clustersK = {1} and the
matrix of the partial order characterized by the formula a {1,1) = 1. Assume that on the step n there
is the set of clusters K.These clusters create a partitioning of the set I ={1,...,n} into non
intersected subsets,
Each cluster k e K is indexed by a maximal number of its nodes.
On the set K we have unit-zero matrix a = \\a{p, q)||pqeK which characterizes the relation of partial order " y ": a{p, q) = 1 if pyk and a{p, q) = 0 in opposite case.
From the new node n +1 no more than m edges exit into the set P(zI of nodes and no more than come into the node n +1 from the set Q( of n nodes. Denote by P, Q the sets of clusters generated by nodes of the sets p, q and define
K p ={k e K : a {p, k) = 1}, p e P; Rq ={k e K : a {k, q ) = 1}, q e Q ;
K' = U Kp, R = U Rq, A = K' n R'.
peP qeQ
The new node n +1 and the clusters from the set A create new cluster (n +1), put A1 := K' \ A, A2 := R' \ A, 5 := K \ (A U A1 U A2), I := IU (n +1). Then a calculation of the matrix a on the step n +1 satisfies the formulas
a(n +1,n +1) = 1, a(n +1, Aj) := E, a(A2,n +1) := E, a(A2, Aj) := E,
a(Aj,n +1) := O, a(n +1, A2) = O, a(Aj, A2) = O, a(B,B) = O, a (B, n +1) = O, a (A1, B) = O, a (B, A2 ) = O.
References
1. Kurosh A.G. Lectures on general algebra. Moscow: Phizmatlit. 1962.