ISSN 10642307, Journal of Computer and Systems Sciences International, 2014, Vol. 53, No. 4, pp. 511–516. © Pleiades Publishing, Ltd., 2014. Original Russian Text © D.S. Kostyanoi, A.V. Mokryakov, V.I. Tsurkov, 2014, published in Izvestiya Akademii Nauk. Teoriya i Sistemy Upravleniya, 2014, No. 4, pp. 43–48.
COMPUTER METHODS
Hypergraph Recovery Algorithms from a Given Vector of Vertex Degrees D. S. Kostyanoi, A. V. Mokryakov, and V. I. Tsurkov Moscow State Aviation Technological University, Moscow, Russia Dorodnitsyn Computing Centre of the Russian Academy of Sciences, Moscow, Russia email:
[email protected] Received March 20, 2014
Abstract—Methods of obtaining certain classes of hypergraphs from a given integer vector of vertex degrees are considered. These classes are as follows: hyperedges with unit weight incident upon k ver tices; hyperedges with unit weight incident upon k vertices in the case when the vertices may be non unique; multiple hyperedges incident upon k vertices; and arbitrary hypergraph in which the edges can contain any set of k vertices. For each of these classes, an algorithm is proposed for constructing the hypergraph from an arbitrary vector. If the construction is impossible, the algorithm determines how much the vector should be reduced so that the hypergraph could be constructed. DOI: 10.1134/S1064230714040091
INTRODUCTION This paper discusses hypergraph recovery algorithms [1] from arbitrary vectors for certain classes of hypergraphs. The ideas of the proposed approach are formulated in [2] in the course of the solution of the resources allocation problem represented by vectors. The construction of hypergraphs runs into difficul ties caused by the strong variability of hypergraphs. A hypergraph can be constructed only when some con straints are imposed on its structure. Denote by Γ(k, n) the hypergraph containing n vertices with hyperedges that can contain k adjacent vertices. Now let us denote by Γ1(k, n) the hypergraph Γ(k, n) whose hyperedges cannot contain duplicate vertices. In contrast, in the hypergraph Γ∞(k, n) each hyperedge can contain up to k identical vertices. The subscript of Γ(k, n) denotes the maximum weight that a hyperedge can have; e.g., the subscript 1 denotes that the weight of all hyperedges is 1 and the subscript ∞ shows that the weight of each hyperedge must be a positive integer. Accordingly, we consider four classes obtained with different combinations of 1 1 subscripts and superscripts. Below, we will abbreviate Γ 1 = Γ 1 (k, n). Hakimi in [3] investigated the problem of the transformation of a vector into a graph. He was the first to mention the possibility of constructing a graph based on an arbitrary vector. In [4–7], the Hakimi algo rithm was modified so that it became possible to obtain all graphs satisfying the initial vector rather than only one graph. However, more complex models require the use of the concept of a hypergraph [8, 9]. In a number of studies [10–12], problems of realization of the vector into a 2complex (hypergraph) have been investigated. These works are based on the results obtained in [13–17]. At the same time, no general algorithm for kcomplexes was obtained. In this paper, we make an attempt to give various versions of real ization of the vector into a hypergraph with certain constraints imposed on its structure. The resulting algorithms are important for obtaining a general algorithm for reconstructing an arbitrary hypergraph. 1
1
1. Class Γ 1 . First, we will considered an algorithm that constructs the hypergraph Γ 1 from a vector, i.e., the hypergraph with unit edges in which the vertices are not repeated. For our algorithms, we need to introduce the following notation: lA(0) is the number of components of a nonnegative integer vector A = (ai) (i = 1, n ) that vanish for i ≥ k. A l g o r i t h m 1. Let an integer nonnegative vector A = (a1, …, an), where n ≥ k be given. The compo nents of A are arranged in nonincreasing order. In order to construct a hypergraph, we will sequentially subtract 1 from k selected components of A. Each such subtraction means the construction of one hyper edge. Thus, the hypergraph will be gradually constructed. 511
512
KOSTYANOI et al.
S t e p 1. Let the vector В = (b1, …, bn), then set the vector A1 = А – В, where ⎧ α 1 = min { a 1, …, a k – 1, n – k + 1 – l A ( 0 ) }, bi = ⎨ ⎩ 1, i = k, n – k + 1 + α 1 .
i = 1, k – 1 ;
S t e p 2. Set the vector А2 = A1 – В, where ⎧ α 2 = min { a 1, …, a k – 2, a k, n – k – l A ( 0 ) }, bi = ⎨ ⎩ 1, i = k + 1, n – k + α 2 .
i = 1, k – 2 ,
i = k;
S t e p n – k. Set the vector An – k = An – k – 1 – В, where ⎧α = min { a 1, …, a k – 2, a n – 1, 1 – l A ( 0 ) }, bi = ⎨ n – k ⎩ 1, i = n.
i = 1, k – 2 ,
i = n – 1;
S t e p n – k + 1. If a1 = 0, then we sort the vector An – k in nonincreasing order of its components and go to Step 1 (in the construction of hyperedges, we assume that the components are enumerated); other wise we find the vector An – k – 1 = An – k – B, where ⎧ α n – k + 1 = min { a 1, …, a k – 2, a k, n – k + 1 – l A ( 0 ) }, bi = ⎨ ⎩ 1, i = k + 1, n – k + α n – k + 1 .
i = 1, k – 2 ,
i = k;
k
In total, up to C n can be subtracted from the vertex ai. The algorithm stops when all the options of sub tractions are enumerated or a vector Ap = 0 . E x a m p l e 1. Let us construct a hypergraph with hyperedges with three vertices based on the vector A = (10, 7, 6, 4, 3). Let us construct a series of hyperedges each containing three vertices {1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5}, {1, 4, 5}, {2, 3, 4}. As a result, we obtain seven sets of three elements in each and the residue of nine elements (four first, three second, and two first). Finally, we have A = ( 10, 7, 6, 4, 3 ); A 1 = ( 9, 6, 5, 4, 3 ); A 2 = ( 8, 5, 5, 3, 3 ); A 3 = ( 7, 4, 5, 3, 2 ); A 4 = ( 6, 4, 4, 2, 2 ); A 5 = ( 5, 4, 3, 2, 1 ); A 6 = ( 4, 4, 3, 1, 0 ); A 7 = ( 4, 3, 2, 0, 0 ). It is easy to track the number of initial sets of elements that can be expanded. ∞
∞
2. Class Γ 1 . The next algorithm constructs a hypergraph of the class Γ 1 in which edges may contain nonunique vertices. A l g o r i t h m 2. Suppose we are given an integer nonnegative vector A = (a1, …, an), where n ≥ k. The components of A are arranged in nonincreasing order. To construct a hypergraph, we will sequentially sub tract from the selected components of A the number k. Each such subtraction means the construction of one hyperedge with repeated vertices. Thus, the hypergraph will be gradually constructed. JOURNAL OF COMPUTER AND SYSTEMS SCIENCES INTERNATIONAL
Vol. 53
No. 4
2014
HYPERGRAPH RECOVERY ALGORITHMS
513
S t e p 1. Let the vector B = (b1, …, bn) and the coefficient of p = 0. Then, set the vector A1 = А – В, where b 1 = min { a 1, k – p };
b i = 0,
i ≥ 2.
S t e p 2. If а1 = 0, then we sort the vector A1 in nonincreasing order of its components and go to Step 1. Otherwise, we increase p by 1 and set А2 = A1 – В, where b 1 = min { a 1, k – p };
b 2 = p;
bi = 0 ,
i ≥ 3.
S t e p 3. Set the vector А3 = А2 – В and p = 1, where b 1 = min { a 1, k – p };
b 3 = p;
bi = 0 ,
i ≠ 1, 3.
S t e p n – 1. Set the vector An – 1 = An – 2 – В and p = 1, where b 1 = min { a 1, k – p };
b n = p;
bi = 0 ,
i ≠ 1, n.
S t e p n. If a1 = 0, then we sort the vector An – 1 in nonincreasing order of its components and go to Step 1. Otherwise, we increase p and set An = An – 1 – В, where b 1 = min { a 1, k – p };
b 2 = p;
bi = 0 ,
i ≥ 3.
The procedure cintinues until a1 > 0 or p < k. If p = k, and a1 > 0, then the vector cannot be realized ∞
into the hypergraph of the class Γ 1 (k, n). E x a m p l e 2. Let the vector А = (47, 38, 20, 17, 9, 5, 4, 2) be given. We construct a hypergraph with hyperedges containing six vertices each: A = ( 47, 38, 20, 17, 9, 5, 4, 2 ); A 1 = ( 41, 38, 20, 17, 9, 5, 4, 2 ); A 2 = ( 36, 37, 20, 17, 9, 5, 4, 2 ); A 3 = ( 31, 37, 19, 17, 9, 5, 4, 2 ); A 4 = ( 26, 37, 19, 16, 9, 5, 4, 2 ); A 5 = ( 21, 37, 19, 16, 8, 5, 4, 2 ); A 6 = ( 16, 37, 19, 16, 8, 4, 4, 2 ); A 7 = ( 11, 37, 19, 16, 8, 4, 3, 2 ); A 8 = ( 6, 37, 19, 16, 8, 4, 3, 1 ); A 9 = ( 2, 35, 19, 16, 8, 4, 3, 1 ); A 10 = ( 0, 31, 19, 16, 8, 4, 3, 1 ). The set of types of elements is sorted (the first element is no longer involved in the expansion); there fore, we pass to the sorted vector A10: A 10 = ( 31, 19, 16, 8, 4, 3, 1, 0 ); A 11 = ( 25, 19, 16, 8, 4, 3, 1, 0 ); A 12 = ( 20, 18, 16, 8, 4, 3, 1, 0 ); A 13 = ( 15, 18, 15, 8, 4, 3, 1, 0 ); A 14 = ( 10, 18, 15, 7, 4, 3, 1, 0 ); A 15 = ( 5, 18, 15, 7, 3, 3, 1, 0 ); JOURNAL OF COMPUTER AND SYSTEMS SCIENCES INTERNATIONAL
Vol. 53
No. 4
2014
514
KOSTYANOI et al.
A 16 = ( 0, 18, 15, 7, 3, 2, 1, 0 ). The set of elements is sorted; therefore, we pass to the vector A16: A 16 = ( 18, 15, 7, 3, 2, 1, 0, 0 ); A 17 = ( 12, 15, 7, 3, 2, 1, 0, 0 ); A 18 = ( 7, 14, 7, 3, 2, 1, 0, 0 ); A 19 = ( 2, 14, 6, 3, 2, 1, 0, 0 ); A 20 = ( 0, 10, 6, 3, 2, 1, 0, 0 ). The set of elements is sorted; therefore, we pass to the vector A20: A 20 = ( 10, 6, 3, 2, 1, 0, 0, 0 ); A 21 = ( 4, 6, 3, 2, 1, 0, 0, 0 ); A 22 = ( 0, 4, 3, 2, 1, 0, 0, 0 ). The set of elements is sorted; therefore, we pass to the vector A22: A 22 = ( 4, 3, 2, 1, 0, 0, 0, 0 ); A 23 = ( 0, 1, 2, 1, 0, 0, 0, 0 ). As a result, we obtain 23 unique edges and four elements from the original vector that could not be allo cated. 1
3. Class Γ ∞ . The third algorithm realizes the original vector into repeating hyperedges with unique ver tices. A l g o r i t h m 3. Suppose we are given an integer nonnegative vector A = (a1, …, an), where n ≥ k. The components of A are arranged in nonincreasing order. To construct a hypergraph, we will sequentially sub tract the maximum possible number p from k selected coordinates of the vector A. Each such subtraction means the construction a hyperedge with the weight p. Thus, the hypergraph will be gradually constructed. S t e p 1. Let the vector В = (b1, …, bn). Then, we set the vector A1 = А – В, where ⎧ α = min { a 1, …, a k }, bi = ⎨ 1 ⎩ 0, i = k + 1, n .
i = 1, k ;
S t e p 2. Since at least one of the components is zero, we sort the vector in nonincreasing order of its components and again go to Step 1. The algorithm stops when the vector becomes zero or when n – lA(0) < k. In the last case, it is impos sible to realize the hypergraph using this algorithm. E x a m p l e 3. Let the vector A = (47, 38, 20, 17, 9, 5, 4, 2). We want to expand the original vector into hyperedges containing three vertices each: A = ( 47, 38, 20, 17, 9, 5, 4, 2 ); A 1 = ( 27, 18, 0, 17, 9, 5, 4, 2 ) ⇒ ( 27, 18, 17, 9, 5, 4, 2, 0 ); A 2 = ( 10, 1, 0, 9, 5, 4, 2, 0 ) ⇒ ( 10, 9, 5, 4, 2, 1, 0, 0 ); A 3 = ( 5, 4, 0, 4, 2, 1, 0, 0 ) ⇒ ( 5, 4, 4, 2, 1, 0, 0, 0 ); A 4 = ( 1, 0, 0, 2, 1, 0, 0, 0 ) ⇒ ( 2, 1, 1, 0, 0, 0, 0, 0 ); A 5 = ( 1, 0, 0, 0, 0, 0, 0, 0 ). As a result, we obtain 47 repeated hyperedges with unique vertices. JOURNAL OF COMPUTER AND SYSTEMS SCIENCES INTERNATIONAL
Vol. 53
No. 4
2014
HYPERGRAPH RECOVERY ALGORITHMS
515
4. Arbitrary class. In the case when hyperedges and vertices in them can be repeated, a series of differ ent algorithms is constructed. Here we consider only one case based on the previous algorithms. A l g o r i t h m 4. Suppose we are given an integer nonnegative vector A = (a1, …, an), where n ≥ k. The components of A are arranged in nonincreasing order. To construct a hypergraph, we will sequentially sub tract the maximum possible number p from k selected components of A. Each such subtraction means the construction of a hyperedge with the weight p. At the end, we combine the remaining vertices as in the sec ond algorithm. Thus, the hypergraph will be gradually constructed. S t e p 1. Use Algorithm 3. S t e p 2. If the resulting vector is not zero, then use Algorithm 2. E x a m p l e 4. Take vector A = (47, 38, 20, 17, 15, 9, 6, 2) and expand into sets with three elements in them A = ( 47, 38, 20, 17, 15, 9, 6, 2 ); A 1 = ( 27, 18, 0, 17, 15, 9, 6, 2 ) ⇒ ( 27, 18, 17, 15, 9, 6, 2, 0 ); A 2 = ( 10, 1, 15, 9, 6, 2, 0, 0 ) ⇒ ( 15, 10, 9, 6, 2, 1, 0, 0 ); A 3 = ( 6, 1, 0, 6, 2, 1, 0, 0 ) ⇒ ( 6, 6, 2, 1, 1, 0, 0, 0 ); A 4 = ( 4, 4, 0, 1, 1, 0, 0, 0 ) ⇒ ( 4, 4, 1, 1, 0, 0, 0, 0 ); A 5 = ( 3, 3, 0, 1, 0, 0, 0, 0 ) ⇒ ( 3, 3, 1, 0, 0, 0, 0, 0 ); A 6 = ( 2, 2, 0, 0, 0, 0, 0, 0 ) ⇒ ( 2, 2, 0, 0, 0, 0, 0, 0 ). Algorithm 3 stops, and the remaining vector is treated using the second algorithm: A 6 = ( 2, 2, 0, 0, 0, 0, 0, 0 ); A 7 = ( 0, 1, 0, 0, 0, 0, 0, 0 ). As a result of the algorithm execution, we obtain 51 hyperedges and one unallocated vertex. CONCLUSIONS Thus, simple, fast, and efficient algorithms were proposed. They can be possibly improved because the problem of uniqueness of the hypergraph recovery from the vector is not solved. In addition, the problem of the recovery of all hypergraphs with the same vector of vertex degrees is not solved. REFERENCES 1. A. A. Zykov, “Hypergraphs,” Usp. Mat. Nauk 29 (6), 89–154 (1974). 2. D. S. Kostyanoi, “Model of the balanced resource distribution in the case of limited resources,” in Proc. of the XXXIX Int. Conference Gagarin Readings (Moscow State Aviation Technological Univ., Moscow, 2013), Vol. 5, pp. 69–70 [in Russian]. 3. S. L. Hakimi, “On realizability of a set of integers as degrees of the vertices of a linear graph. I”, SIAM J. 10, 496–506 (1962). 4. A. A. Mironov, “Geometry of the points of the space R n that are realizable into a graph,” Usp. Mat. Nauk 32 (6), 231–232 (1977). 5. A. A. Mironov and V. I. Tsurkov, “Graphical representation of multilayered hierarchical structures,” J. Comput. Syst. Sci. Int. 30 (5), 114–119 (1992). 6. A. A. Mironov, “On the representation of number sets by graphs and properties of graphs with a given set of ver tex degrees,” in Tr. Gor’kovskogo Gos. Univ. (Izd. Gorki Gos. Univ., Gorki, 1981), pp. 76–97 [in Russian]. 7. A. A. Mironov, “Uniform generalized graphs,” Dokl. Math. 54, 965–968 (1996). JOURNAL OF COMPUTER AND SYSTEMS SCIENCES INTERNATIONAL
Vol. 53
No. 4
2014
516
KOSTYANOI et al.
8. A. A. Zykov, “Some properties of linear complexes,” Mat. Sb, No. 24 (1949). 9. A. V. Mokryakov, “Hypergraphs as algebraic structures,” J. Comput. Syst. Sci. Int. 50, 734–740 (2011). 10. A. A. Mironov, A. V. Mokryakov, and A. A. Sokolov, “About realization of integer nonnegative numbers tuple into 2dimensional complexes,” Applied Comput. Math. 6 (1), 58–68 (2007). 11. A. A. Mironov and A. V. Mokryakov, “Twodimensional complexes that can be completely described by vertex degrees,” in Tr. ISA RAN, Dynamics of Nonhomogeneous Structures, No. 10, Ed. by Yu. S. Popkov (KomKniga, Moscow, 2006) [in Russian]. 12. A. V. Mokryakov and V. I. Tsurkov, “Reconstructing 2complexes by a nonnegative integervalued vector,” Autom. Remote Control 72, 2541–2552 (2011). 13. A. A. Mironov and V. I. Tsurkov, “Class of distribution problems with minimax criterion,” Dokl. Ross. Akad. Nauk 336 (1), 35–38 (1994). 14. A. A. Mironov, T. A. Levkina, and V. I. Tsurkov, “Minimax estimations of arc weights in integer networks with fixed node degrees,” Appl. Comput. Math. 8, 216–226 (2009). 15. A. A. Mironov and V. I. Tsurkov, “Transportation problems with a minimax criterion,” Dokl. Math. 53, 119– 122 (1996). 16. A. A. Mironov and V. I. Tsurkov, “Minimax under nonlinear transportation constraints,” Dokl. Math. 64, 351– 354 (2001). 17. A. A. Mironov and V. I. Tsurkov, “Open transportation models with minimax criterion,” Dokl. Math. 64, 374– 377 (2001).
Translated by O. Pismenov
JOURNAL OF COMPUTER AND SYSTEMS SCIENCES INTERNATIONAL
Vol. 53
No. 4
2014