Graph realizations constrained by skeleton graphs

In 2008 Amanatidis, Green and Mihail introduced the Joint Degree Matrix (JDM) model to capture the fundamental difference in assortativity of networks in nature studied by the physical and life sciences and social networks studied in the social sciences. In 2014 Czabarka proposed a direct generalization of the JDM model, the Partition Adjacency Matrix (PAM) model. In the PAM model the vertices have specified degrees, and the vertex set itself is partitioned into classes. For each pair of vertex classes the number of edges between the classes in a graph realization is prescribed. In this paper we apply the new {\em skeleton graph} model to describe the same information as the PAM model. Our model is more convenient for handling problems with low number of partition classes or with special topological restrictions among the classes. We investigate two particular cases in detail: (i) when there are only two vertex classes and (ii) when the skeleton graph contains at most one cycle.


Introduction
In the last fifteen years, the exponential development of network theory has raised the practical problem of realizing and sampling large graphs with given degree sequences. Finding a realization of a given degree sequence (among simple graphs or graphs with a given maximum number of parallel edges or/and loops) has long been shown to be an easy problem. Havel [12] first solved the problem in 1957, and his algorithm was reinvented by Hakimi [11] in 1962. An even older but less efficient way to find realizations can be derived from Tutte's f -factor results [25,26]. Another method was due to Paul Erdős and Gallai [7] in 1960, but the resulting algorithm was derived from Havel's approach. All these methods lack the ability of generating all (or even a large number of different) realizations. The problem of determining if there exists a graph with given degree sequence and satisfying other specified conditions will be called in this paper the realization problem.
In many situations, it is not feasible to generate all realizations, as the number of possible realizations can be exponential or larger in the length of the degree sequence. In this case, practical applications may require reasonable sampling methods of the "typical" realizations. A common approach is to use Markov Chain Monte Carlo methods, which require some simple operations that transform one realization into another, slightly different realization. Additionally, it must be possible to transform any given realization into any other using these operations. This particular subproblem of the sampling procedure will be called in this paper the connectivity problem (also known as the irreducibility problem in the context of Markov Chain Monte Carlo processes for sampling random realizations).
In modern graph theory the first such manipulation was Havel's swap operation from [12]. (The terminology and notation used in this paper will be introduced in detail in Section 2.) It is interesting to remark that his method was applied already by Petersen [18] in 1891, who essentially showed that any realization of a given degree sequence can be transformed into any other realization of the same degree sequence by a series of such swap operations. In 1951 Senior [20] also used this approach to construct possible hydrocarbon molecules with given atomic composition. For bipartite graphs it was done by Ryser [19] in 1963, and all these results have been invented again and again.
Recently a large number of real-world social and biological networks were studied in detail. One important distinction between these two types of networks lies in their overall structure: social networks typically have a few very high degree vertices and many low degree vertices with high assortativity (where a vertex is likely to be adjacent to vertices of similar degree), while biological networks are generally disassortative (in which low degree vertices tend to attach to those of high degree). It is easy to see that the degree sequence alone cannot capture these differences. There are several approaches to address this problem. See the paper of Stanton and Pinar [22] for a detailed description of the current state-of-the-art.
One way to address this problem is the joint degree matrix model (or JDM for short). This model is more restrictive than the degree distribution, but it provides a way to enhance results based on degree distribution. It was introduced by Amanatidis, Green and Mihail [1] and Stanton and Pinar [22]. In essence, the JDM specifies the exact number of edges between vertices of degrees i and j. More precisely, a joint degree matrix where J ij = |{xy ∈ E(G) : d(x) = i and d(y) = j}|. It is clear that the degree sequence of the graph is determined by its JDM: (the number of vertices of degree i) The novelty of this definition is that values J ij are exact numbers, and not expectations, like in earlier approaches, see for example [16]. The existence problem for the JDM model is not hard: already Patrinos and Hakimi [17] presented in 1976 an Erdős-Gallai-type theorem for joint degree matrices, essentially characterizing precisely those matrices which are the joint degree matrix for some graph, though using different terminology. Another proof for this result was given in [1], see also [2]. Stanton and Pinar [22] gave a separate, constructive proof for this theorem, which builds a particular graph that has a given matrix as its JDM. Czabarka, Dutle, Erdős and Miklós [3] presented a simpler proof using a construction algorithm that can create every graph with a given JDM. See also [10].
The connectivity problem for the JDM model proved to be more complicated. Stanton and Pinar [22] solved it for the space of all multigraph realizations. For simple graphs it was resolved affirmatively by Czabarka, Dutle, Erdős and Miklós [3].
The JDM model suggests a more general restricted degree sequence problem: the partition adjacency matrix model (or PAM for short). In this generality, it was introduced byÉ. Czabarka [4]. Let Π = (P 1 , · · · P k ) be a partition of the vertex set V of the graph G. Let d be the degree sequence of G, and let M be the following k × k matrix: if i = j then the entry M i,j is the number of edges in the bipartite subgraph G[P i , P j ], while M i,i is the number of edges within the induced subgraph G[P i ]. The matrix M is called the partition adjacency matrix of the graph G for the partition Π. Clearly the PAMproblem is: we are given a positive integer sequence on the partitioned V and a matrix M and we want to decide whether there is a graph G with the given degree sequence and with the given PAM.
The joint degree matrix determines the degree sequence itself by equation (1). Therefore the JDM is clearly an instance of the PAM-problem. The PAM problem in full generality is probably quite complicated: when we have, say, |V | partition classes, then the problem is conjectured to be NP-complete.
In this paper we will consider an auxiliary structure to describe the PAM problem. This is a more convenient description when there are only a small, say, linear number of items in M which are not zero. This object also provides structural properties of the edges among the vertex partitions. This description is based on the notion of a skeleton graph, and it is described in detail in Section 2.
the electronic journal of combinatorics 24(2) (2017), #P2.47 We study two particular skeleton graphs in detail: the first one consists of two partition classes with edges inside the classes allowed, while in the second one each of its components contains at most one cycle while the classes have no edges inside. In both cases we show how to quickly construct graphical realizations in all feasible cases. We also consider whether the space of all realizations are connected. The answers in both cases are almost affirmative: the space is connected if we use swaps as well as an additional operation called double swaps.

Definitions and tools
Let G = (V, E) be a simple graph with vertex set V = {v 1 , . . . , v n } and edge set E (no multiple edges or loops). Denote d(G) = (d(v 1 ), . . . , d(v n )) its degree sequence. This sequence is not ordered in any way. The graph G is called a realization of the previous sequence. A sequence d = (d 1 , . . . , d n ) of nonnegative integers is graphical if it has at least one realization. The set of all realizations of a graphical degree sequence d is denoted by G(d).
We consider realizations of a degree sequence d = (d 1 , . . . , d n ) that are restricted by a "skeleton" graph S in the following way. We fix a partition Π = {U, W, . . .} of V.
A skeleton graph is an edge-weighted graph S = (Π; B, w) on the partition classes in Π with possible loops. We will refer to a vertex of S as a class and the edges of the skeleton graph S are referred to as bones. We will use the following, very natural, notation: for U, W ∈ Π, if the pair U W is a bone in B, then w(U W ) is its weight (in S).
is the induced simple graph within U. The graphs G[U, W ] are the component graphs of G. When the partition classes in Π consist of all vertices with the same degrees, then all the introduced notions are equivalent to the notions used for the Joint Degree Matrix model in [3].
We will say that the realization G of degree sequence d is consistent with the skeleton We say that the pair (d, S) is graphical if there exists a realization G of d which is consistent with S. See for example in Figure 1 a skeleton graph S and a realization G that is consistent with S. We will consider several different realizations of a degree sequence, even ones that are not consistent with the skeleton graph. However we will not consider realizations which have edges in a component graph without a corresponding bone. Therefore, we call a pair of vertices within a component graph with a corresponding bone a chord, and each other pair of vertices a non-chord. So a chord is a pair of vertices which may form an edge in a consistent realization. A realization G of a degree sequence d is weakly consistent with S if all of the edges of G are chords. Here property (2) may not hold. Although the existence problem of weakly consistent realizations is not interesting in itself, we will use it as a tool. Before we discuss this, we recall some details about Tutte's f -factor theorem and its applications.  Figure 1 The dashed circles illustrate the classes of a skeleton graph S, while its bones are indicated by gray dashed tubes. The dots and solid lines show a graph G that is consistent with S.
In 1947 Tutte completely characterized the graphs with perfect matchings (see [24]). In 1952 he generalized this result for the so called f -factor problem. Two years later, in 1954, Tutte found the following brilliant way to reduce the problem of finding an f -factor in a given graph to finding a perfect matching (a 1-factor) in an auxiliary graph ( [26]). Let G be a simple graph and let f (v) be a non-negative integer for each v ∈ V . Then a subgraph F of G in which each vertex v ∈ V has degree f (v) is an f -factor of G. Any f -factor in G can be represented as a perfect matching in the auxiliary graph T(G, f ): e v e u e = vu ∈ E(G) .
It is easy to see that there is a natural bijection between the f -factors in G on one hand and the perfect matchings in T(G, f ) on the other hand. More precisely, given the perfect In 1965, Edmonds described an effective algorithm to find a maximum matching in G ( [5]). Then, in the same year, he extended his approach for edge-weighted graphs ( [6]): his blossom algorithm finds a maximum-weight perfect matching in strongly polynomial time. We will use this result extensively in this paper. The classical existence problem for degree sequences can be easily solved by Tutte's f -factor theorem and Edmonds' algorithm: take as graph G the complete graph on n vertices and for the function f the the electronic journal of combinatorics 24(2) (2017), #P2.47 degree sequence. (See for example [13] for an outstanding application.) However, this method is less efficient than the methods based on Havel's observation, and it cannot be used to find all possible realizations (see for example [14]). Nevertheless, Edmonds' blossom algorithm is excellent to find weakly consistent realization to any skeleton graph: Observation 2.1. For any degree sequence d and any skeleton graph S = (Π; B, w), one can decide in strongly polynomial time whether there exists a realization of d that is weakly consistent with S.
Proof. The graph G in the f -factor problem consists of all chords defined by the skeleton graph, while the f -function is equal to the given degree sequence.
It is clear that the f -factor approach cannot directly find consistent realizations for any "reasonable" skeleton graph problem: it has no control over the exact number of edges in the component graphs. We even cannot enforce that all bones contain at least one edge in the derived realization. We need additional ideas to find consistent realizations. For that end we will extensively use some restricted versions of Havel's swap operation.
This swap operation, denoted by ab, cd ⇒ bc, ad, was introduced by Havel [12]. It is also known, for example, as switch or rewiring or infusion operation.
(R2) Let S be a skeleton graph, and let G be a realization of d that is weakly consistent with S. If all vertex pairs in (R1) are chords, then G will be weakly consistent with S. Then the operation is a restricted swap operation.
(R3) If G is consistent with the skeleton graph S and G is also consistent with S, then this operation is an S-preserving swap operation.
As we mentioned earlier already Petersen proved ( [18]) that any realization of a given degree sequence can be transformed into another one by consecutive unrestricted swap operations. Havel's result gives a rather crude algorithm to find such a swap sequence: the number of steps may be twice the number of edges in the worst case. It is very natural to ask what the minimum length of such a swap sequence is. This question was studied in details by Erdős, Király and Miklós ( [8]). Next we will summarize the main findings of their paper: Regular swap sequences: Let G and G be two realizations of the degree sequence d.
The symmetric difference ∇ = E(G) E(G ) of their edges has a natural 2-coloration: an edge in ∇ is red or blue depending on whether it belongs to G or G . Denote by r(G, G ) the number of red edges in the symmetric difference (which is of course also the number of blue edges).
The following statement is a simple observation: the electronic journal of combinatorics 24(2) (2017), #P2.47 Lemma 2.3. Every vertex in ∇ has an equal number of red and blue adjacent edges. Moreover, the symmetric difference ∇ can be decomposed into even length alternating (with respect to the coloration) circuits (closed walks), where no circuit contains any vertex more than twice.
Consider now two realizations G and G such that ∇ is one alternating circuit, C. The next lemma is one of the central results in [8]: There exists a sequence of consecutive swap operations transforming realization G into G with the following properties: (i) Along the process every swap is applied for vertex pairs belonging completely to V (C). (ii) If G 1 and G 2 are two consecutive realizations along the sequence then r( The described swap sequence is called a regular swap sequence. Theorem 2.5 (Erdős-Király-Miklós, [8]). Let G and G be arbitrary realizations of degree sequence d. Every shortest possible swap sequence can be reordered such that this realigned sequence is identical with a series of subsequent regular swap sequences, corresponding to a circuit decomposition of the symmetric difference ∇. The length of this swap sequence is r(G, G ) − the maximum possible number of circuits in a decomposition, and hence is at most r(G, G ) − 1.
With some lack of precision we also call the swap sequence described above as a regular swap sequence, and a shortest regular swap sequence, respectively. Two further useful observations: Remark 2.6.
(i) Any particular alternating circuit in ∇ can be extended into a complete decomposition of ∇.
(ii) If an arbitrary swap sequence transforms G into G then the inverse swap sequence transforms G into G (here we do not define the notion inverse, because it is selfevident).
The following is easily verified.
Observation 2.7. In an S-consistent realization G, a swap ab, cd ⇒ bc, ad is S-preserving if and only if either a and c, or b and d are in the same class of S.
One of our motivating questions is whether the space of realizations of a graphical sequence consistent with a given skeleton graph is connected using swaps. In the classic cases this is true (see, for example, Theorem 2.5) as well as in the Joint Degree Matrix case (see [3]). However, as we will see later on, there is not so neat answer for the skeleton graph problems. The obvious reason for this is that Theorem 2.5 does not apply for this case, since a regular swap sequence does not necessarily use S-preserving swap operations.

Graph realizations with a given number of edges crossing a given bipartition
We start our investigations with one of the most simple skeleton graphs. Let V = {v 1 , . . . , v n } be a vertex set, d a degree sequence, Π 2 = (U, W ) a partition of V , k ∈ N and let S(k) = (Π 2 ; B, w) be a skeleton graph with two vertices, a weight-k U W bone and two loops, whose weights are completely defined by d and k. The edges with end vertices in both classes are called the crossing edges. The conventional description is the following: Given the degree sequence d, a bipartition of the vertex set and a natural number k, decide if there exists a graph that realizes the given degree sequence and has precisely k crossing edges.
When k is equal to the total number of edges, i.e. both classes induce the empty graph, then this coincides with the usual bipartite degree sequence problem.
When W has no inner edges, then no direct greedy method (like Havel's lemma) is known to construct a consistent realization. The reason for that is simple: we just do not know the U -side of the bipartite degree sequence in the component graph G[U, W ]. However, the Tutte -Edmonds method provides an effective solution for the existence problem.

Existence
It is clear that any realization of d is automatically weakly consistent. In this subsection we consider the existence problem for consistent realizations. The number of crossing edges in a realization G is denoted (G). The set of all realizations of degree sequence d with crossing edges is denoted G (d).
Let G ∈ G (d) and let G be the realization derived from G by the swap operation ac, bd ⇒ bc, ad. By simple case analysis it is easy to see that Denote by m (d) the minimum value of such that G is not empty, and similarly denote by M (d) the maximum value. By Lemma 3.2 the sets of all weakly consistent realizations are not empty while all other sets G (d) are empty.
Edmonds' blossom algorithm [6] applied to the Tutte gadget T(K n , d) can easily find the minimum and maximum values m (d) and M (d) together with the corresponding realizations consistent with S( m (d)) and S( M (d)), respectively.
We first assign weight 0 to all crossing edges in T(K n , d), while to all other edges we assign weight 1. Then any maximum weight perfect matching corresponds to a realization G which contains the minimum possible number of crossing edges. Therefore m (d) = (G). To determine M we just reverse the edge weights. So the solution of the maximum weight matching problem for this graph provides the value M (d) and a realization G ∈ G M (d) .
The formula (6) gives all other possible values while the proof of Lemma 3.2 (ii) describes the way to find realizations with specific -values.
This proof seems to be easy and straightforward. However, the situation is more complicated. First of all, as far as the authors are aware, this is the very first solved degree sequence type problem without some direct, greedy type solution. Secondly, it is somewhat unusual to solve an existence problem, where the two extremal solutions can be found directly, while the solutions inbetween can be inferred only indirectly from the extremal solutions. Finally, we think that it is a small miracle that this proof works at all. Consider the following, slightly different question: the vertices, equipped by a degree sequence d, are partitioned into three classes: U, W, Z. We are looking for a realization G of d which has exactly k edges between U and W. There is no any other restriction. (Of course this problem does not belong to the skeleton graph problem class, but the difference is tiny.) For this problem, Lemma 3.2 does not hold. Therefore, finding realizations with minimum m and maximum M number of crossing edges does not help to solve the problem if m < k < M . Actually, this problem seems to be quite hard, and the authors were not able to provide a polynomial-time algorithm solving it despite of serious efforts.

Connectivity
Now consider two realizations G, G of degree sequence d, consistent with the skeleton graph S(k) = (Π 2 ; B, w). Is it true that in such a situation there always exists a sequence of S-preserving swaps that turn G into G ? The following counter example shows that the answer to the above question is "no". Theorem 3.3. There exist graphs G, G that have the same vertex set V , the same degree sequence d and that are both consistent with the skeleton graph S(k) = (Π 2 ; B, w) described above, such that there exists no sequence of S-preserving swaps that turn G into G .
Proof. We construct an example as follows. Let d = (6, 6, 3, 3, 3, 3, 1, 1) be the degrees of vertices (u 3 , w 7 , u 2 , w 6 , u 1 , w 5 , u 0 , w 4 ). Let S be the skeleton graph with Π = {U, W } the electronic journal of combinatorics 24(2) (2017), #P2.47 with U = {u 0 , u 1 , u 2 , u 3 }, W = {w 4 , w 5 , w 6 , w 7 } and with bone U W with weight k = 7. Then both vertex classes must contain 3 edges. In Figure 2 we show all realizations of this degree sequence that are consistent with S. There is a single S-preserving swap that turns G 1 into G 2 , namely the swap u 2 w 5 , u 1 w 6 ⇒ u 1 w 5 , u 2 w 6 . However, there is no S-preserving swap that turns G 1 into G 3 or G 2 into G 3 . (See Figure 3 where the red and blue chords can be found in only one realization, while the black chords are in both.) Hence, there is no sequence of S-preserving swaps that turns G 1 or G 2 into G 3 . Figure 2 There is no sequence of S-preserving swaps that turns G 1 or G 2 into G 3 .  Proof of Theorem 3.4. The proof is by induction on r(G, G ). Let's recall that this is the number of red edges in G G which is 1 2 |E(G) E(G )|. If r(G, G ) = 0 then G = G and we are done. Moreover, if r(G, G ) = 2 then we can turn G into G by applying the single swap consisting of the red and blue edges of ∇ and we are again done. (It is easy to see that r(G, G ) cannot be 1.) Hence, assume r(G, G ) 3. In a sequence of lemmas we will show that we can always find an S-preserving swap and/or double swap sequence which reduces r(G, G ). In each lemma we identify an alternating circuit in ∇ s.t. the regular swap subsequence processing this circuit will apply only S-preserving swaps, and will hence satisfy the conditions described in Theorem 3.4.

U W
Lemma 3.5. If one can find an alternating circuit C ⊂ ∇ completely within a vertex class, say, U , then the regular swap subsequence processing C (see Theorem 2.5) provides S-preserving swaps at each step.
Proof. Indeed, the regular swap sequence can start with that particular circuit-see Lemma 2.6(i)-and the process uses chords of this circuit, therefore all swap operations happen inside class U and hence all swaps are S-preserving.
From now on we assume that there exists no alternating circuit completely within any vertex class. To make the references easier for different type of chords in the realizations, we introduce two further notions: we say that a chord is black if it is an edge in both G and G . It is white if it is an edge neither in G nor in G . Lemma 3.6. Assume that there exists a red crossing edge and a blue crossing edge that share an endpoint. Then we can identify an alternating circuit C such that the regular swap subsequence which processes C provides only S-preserving swaps. The red chord is an edge in G but not in G . Analogously the blue chord is an edge in G but not in G. Either au is blue but ax is not blue, or bx is red but bu is not red.
Proof. Suppose that e 1 = uv is a red crossing edge and e 2 = xv is blue crossing edge, where u, x ∈ U and v ∈ W ; see Figure 4. We first show that there is a vertex a ∈ V (G)\{u, v, x} such that au is blue but ax is not blue, or there is a vertex b ∈ V (G) \ {u, v, x} such that the electronic journal of combinatorics 24(2) (2017), #P2.47 bx is red but bu is not red. If no such vertex a exists, then d b (u) < d b (x), and if no such vertex b exists, then d r (x) < d r (u). But since d r (u) = d b (u) and d r ( , which contradicts the previous sentence. Hence such vertex a or vertex b exists. Without loss of generality assume that there exists a vertex a such that au is blue but ax is not blue. If ax is red or black, then we apply the S-preserving swap au, uv, xv, ax to G to obtain G * , a consistent realization. Since r(G * , G ) < r(G, G ) therefore the induction applies.
If ax is white, then we apply the swap au, xv ⇒ ax, uv for realization G. (Here we apply Lemma 2.6 (ii).) For the derived realization G * the number of red edges within E(G) E(G * ) is smaller than r(G, G ) and induction applies.
From now on we assume that there exist no adjacent red and blue crossing edges. Proof. Suppose that such an alternating trail T exists. Let e 1 = uv be the red crossing edge in T and e 2 = xy be the blue crossing edge, where u, x ∈ U , v, y ∈ W , and the other edges of T lie within W . Let R be the subtrail of T from v to y formed from T by removing e 1 and e 2 , then R contains at least two chords. See Figure 5 for a picture. Consider the pair uy. Since Lemma 3.6 does not apply, uy is a black or white chord. If uy is black, then denote by C the chord circuit (R, vu, uy). This has exactly two crossing chords, one is red (an edge in G but non-edge in G ), the other is blue (a non-edge in G but an edge in G ), and it alternates between red and blue chords: every second chord is red, the others are blue. Denote by C * the chord circuit derived from C by switching blue and red chords along C and denote by G * the graph derived from G by exchanging C and C * . Then G * is clearly another realization of d and since C * has two crossing chords, one is an edge, the other is a non-edge, therefore, G * is consistent with the skeleton graph S(k). Since trail R contains at least one red chord, the number of red edges in E(G) E(G * ) is the electronic journal of combinatorics 24(2) (2017), #P2.47 smaller than r(G, G ) and, consequently, the inductive assumption applies for G and G * : there exists a sequence Σ 1 of S-preserving swaps and double swaps transforming G into G * . Furthermore, since T was not closed, the number of red edges in E(G ) E(G * ) is smaller than r(G, G ) and, therefore, the inductive assumption applies for G * and G as well: there exists a sequence Σ 2 of S-preserving swaps and double swaps transforming G * into G . So the swap-sequence Σ 1 • Σ 2 transforms G into G via S-preserving operations.
If uy is white, then we consider exactly the same circuit C and let C * be derived in the same way. However, G * is now derived from G by exchanging C and C * . Again G * is consistent with the skeleton graph S(k). Since r(G, G * ) = |T |/2 < r(G, G ), there exists an S-preserving swap sequence Σ 1 from G to G * . Similarly there exists an S-preserving swap sequence Σ 2 transforming G * into G . So the swap-sequence Σ 1 • Σ 2 transforms G into G via S-preserving operations. Now we are ready to finish the proof of Theorem 3.4: Consider the symmetric difference ∇. Assume at first there is a connected component in ∇ containing both red and blue crossing chords. Then they are connected with an alternating chord trail and traversing it will reveal a red and blue crossing chord pair as in Figure 5. Therefore we may assume that no connected component has both red and blue crossing chords. Next we decompose it into alternating chord circuits and let C 1 and C 2 be two of them, the first has red crossing chords while the second one has blue crossing chords. By our assumptions these two circuits are vertex disjoint.
Let Σ 1 denote a regular swap sequence processing C 1 and let Σ 2 denote the analogous regular sequence for C 2 . Now we execute Σ 1 step by step while the required swaps are S-preserving. Let Σ 1 (i) denote the last performed operation. If the swap Σ 1 (j), where j i, produced realization H and r(H, G ) is smaller than r(G, G ), then the inductive hypothesis applies. So we suppose here that the operations Σ 1 (1), . . . , Σ 1 (i) only split the alternating chord circuits into smaller ones.
At this point we execute the swap sequence Σ 2 step by step while the required swaps are S(k)-preserving. Let Σ 2 (j) denote the last performed operation. We let H denote the current realization, which is consistent with S(k) and has r(H, G ) equal to r(G, G ). Now we execute the double swap Σ 1 (i + 1) and Σ 2 (j + 1) which together produce a new realization H which is consistent with S(k) and for which r(H , G ) is smaller than r(G, G ). The inductive hypothesis applies. This completes the proof of Theorem 3.4.

Multipartite graph realizations
This section considers skeleton graphs with more than two classes but without loops. First, we consider skeleton graphs that contain exactly one odd cycle. We can calculate the number of edges in the bone U 2 U 3 : it is D(U 2 ) − α. The number of edges along the bone U 3 U 4 is D(U 3 ) − D(U 2 ) + α. And so on: we can calculate the number of edges in all bones, one by one. We finish it to calculate the number of edges in the bone U 2k−2 , U 2k−1 which is some β, a linear function of α with coefficient 1. Finally we know that α + β = D(U 2k−1 ). So α is fully determined. If a weakly consistent realizations exists then the solution for α must provide non-negative integer values w * (U i U i+1 ) for all bones.
The easy consequence is that all weakly consistent realizations are consistent with exactly the same weight function: each belongs to S(w * ).
By the above lemma, we can solve the existence problem for this particular skeleton graph by deciding if there exists a realization of d that is weakly consistent with S. But Observation 2.1 does exactly this for us.

Corollary 4.2.
There exists a polynomial algorithm to decide the existence of a consistent realization to the skeleton graph problem above.
Before we proceed to even cycles we need some definitions and a result about restricted degree sequence problems from [9]. Let F be a subset of the vertex pairs from V . The other vertex pairs on V are called chords. Let d be a degree sequence on V . We are interested in those realizations of d which completely miss F (the forbidden set of nonchords). The set of all such realizations is denoted by G F (d).
Consider a realization G = (V, E) ∈ G F (d) where v 1 , . . . , v 2k is an alternating (edge, non-edge, . . . etc.) circuit of chords. Assume that all pairs v i v j which would divide C into two even chord circuits (these are the pairs i, j ∈ {1, . . . , 2k} with j = i + 1 (mod 2) and |i − j| > 1) are forbidden (they are not chords). Then the operation which exchanges the edges and non-edges along the circuit C is called an F -swap. It is clear that if F = ∅ then this notion coincides with Havel's swap notion. The following result follows directly from Theorem 2.3 of [9]: the space G F (d) is connected under F -swaps. More precisely: ). Let G, G ∈ G F (d) be two realizations. Then there exists a sequence of F -swaps which turns G into G . Moreover if the symmetric difference between G and G is one alternating chord circuit, then all the F -swaps happen within the vertex set of C.
We continue our investigations with considering skeleton graphs consisting of one even cycle: we use similar notations as before except that the last vertex partition is denoted by U 2k and the cycle is modified accordingly. The existence problem for such skeleton graphs was originally raised for the case k = 2 by László A. Székely [23]; he also suggested a solution for this particular question. Now we can do the same calculation here that happened in the proof of Lemma 4.1. However, the final equation contains no α, it is just an alternating sum of D(U i )s, an identity. Therefore there may exist several feasible values for α, and it is possible to find all feasible weight functions (a constant number) and to find at least one consistent realization for each feasible weight function in polynomial time. More precisely: Proof. When our cycle C has odd length, then Lemma 4.1 and Corollary 4.2 apply and we have nothing to prove. So assume now that C = (U 1 U 2 , . . . , U 2k U 1 ). Applying the method of Observation 2.1 with weight 0 for all chords in the bone U 1 U 2 and 1 for all other chords, the derived maximum weight perfect 1-factor provides the value α m and a corresponding degree sequence realization. If we consider the opposite weight function then the maximum weight perfect 1-factor provides the value α M and a corresponding degree sequence realization.
Finally one can find in polynomial time at least one realization for each value α = α m , α m + 1, . . . , α M applying Theorem 4.3 as follows: from this statement we know that G can be transformed into G using F -swaps. In this setup the chords are the vertex pairs within the bones, all other vertex pairs are forbidden. When G and G are from G(Π, B) then they can be consistent with different weight functions w and w . In any procedure transforming G into G each F -swap alters the edges and non-edges along an alternating chord circuit C . There are two possibilities: this C can go around the bone-circuit C zero or an even number of times or an odd number of times. In the first case for each bone the number of edges in this bone before and after the swap will be the same. In the second case the numbers of the edges within the bones increase and decrease with exactly one, alternately. Therefore each possible value α between α m and α M must occur in the bone U 1 U 2 . Now we discuss in short another possible multipartite skeleton graph: Proof. This statement is almost trivial. One can argue in the same way as it happened in the proof of Lemma 4.1: starting from the leaves different from L and working along the paths toward L one can determine all D(U W ) values along the tree. At the last step on the unique bone U L the value w(U L) must be the same as D(L). Putting together these statements we have the following result: Theorem 4.6. Let d be a sequence of |V | positive integers and let S = (Π; B) be a connected skeleton graph with at most one cycle. Then we can find in polynomial time all weight functions w for which there exists realizations of d which are consistent with the skeleton graph S = (Π; B, w) along with at least one realization for each possible weight function.
Proof. We may and will assume that the skeleton graph has exactly one cycle C and trees connected to the vertices of that cycle because otherwise Lemma 4.5 would apply. If at vertex class U of C in the connected tree the vertex U has a neighbors, then we consider a disjoint subtrees, all rooted in U . For each subtree the application of Lemma 4.5 determine the corresponding weight function values, and together they determine the "residual" D(U ) for the cycle C. This can be done in polynomial time.
If C is odd, then it provides one unique weight function as possible setup for consistent realizations. The usual application of the Tutte method provides in polynomial time a weakly consistent realization of d which will be automatically consistent.
If C is even, then the application of Lemma 4.4 provides the possible weight functions, together with actual consistent realizations for each possible weight function.
This finished the discussion of the existence problem of consistent realizations for skeleton graphs S = (Π; B, w) where all connected components contain at most one cycle. In the remainder of this section we discuss briefly the connectivity problem of the space of all consistent realizations.
First of all we have to recognize that instead of asking the connectivity of the realization space G(S) under the regular swap operations we have to consider the F -swap operations, defined by the forbidden edges outside the active bones.
Assume that our skeleton graph is connected and it has at most one cycle. If this cycle is odd, then there is at most one weight function for which G(S) is not empty, and every weakly consistent realization will be automatically consistent as well, so the F -swap operations do not destroy the consistency. The application of Theorem 4.3 proves the connectivity of the space.
When the cycle under consideration is even then we have a more complex situation. First of all there may be several different weight functions with consistent realizations, and-similarly to the bipartite case S(k)-it is possible that G(S) is not connected under F -swaps. However, again similarly to the bipartite case, one can organize the F -swap sequence such that whenever we have to leave the current weight function w into wwhich differs from w with one on each bone along the cycle-then the next F -swap goes back again to the original weight function. Thus, GS) is connected under F -swaps and "double F -swaps".