Submitted:
11 June 2026
Posted:
11 June 2026
You are already at the latest version
Abstract
A continuous graph, or metric graph, is obtained from a finite graph by replacing each edge by a unit interval and using the induced shortest-path metric. Recent work of Grigoriev and Faulkner formulated continuous analogues of several classical graph-optimization problems, including independent set, vertex cover, chromatic number, and treewidth. In this paper we solve exactly the distance-two independent-set problem for continuous complete multipartite graphs. Let \[ G=K_{n_1,\ldots,n_k},\qquad N=\sum_{i=1}^k n_i,\qquad M=\max_{1\le i\le k} n_i, \] where $k\ge 2$ and \(n_i\ge 1\). We prove that \[ \alpha_1(\Gamma(G))=\max\left\{M,\floor{N/2}\right\}, \] where \(\alpha_1\) is the maximum cardinality of a set of points in \(\Gamma(G)\) whose pairwise metric distances are at least two. The formula shows that the optimum is governed by two support mechanisms: selecting vertices from a largest part, or using interior points supported on the edges of a maximum matching; choosing the midpoints gives a canonical optimal realization of the matching construction. We also give an exact constructive algorithm, EMCIA, for computing the value and producing a labelled optimal configuration. The value is computed in $O(k)$ time; a labelled optimal configuration is produced in $O(N\log k)$ time using a priority queue, or in $O(N)$ time after bucket sorting when the part sizes are bounded. Reproducible numerical illustrations show the transition between the largest-part and matching-supported regimes and include a quantitative balance-entropy diagnostic for the input part-size distribution.
Keywords:
continuous graph
; metric graph
; independent set
; complete multipartite graph
; exact algorithm
MSC: 05C69; 05C85; 05C70; 68R10; 90C27
1. Introduction
The maximum independent-set problem is a central problem in graph theory, combinatorial optimization, and theoretical computer science. For a finite graph, an independent set is a subset of vertices containing no adjacent pair, and the corresponding optimization problem is one of Karp’s classical NP-complete problems [5]. In many geometric, network, and scheduling models, however, an edge is better regarded as a one-dimensional continuum rather than as a purely combinatorial adjacency. This leads to the study of metric graphs: geometric realizations of finite graphs in which edges are represented by intervals and distances are shortest-path distances in the resulting one-dimensional metric space [1,8].
The systematic study of continuous analogues of classical graph-optimization problems has recently been developed by Grigoriev and Faulkner [4]. In that framework, an edge of a finite graph is replaced by a unit interval, and optimization variables may be placed anywhere on the resulting continuous graph. The continuous setting changes the nature of several classical parameters: selected points, covering points, and coloring constraints are no longer restricted to the original vertex set. Consequently, even graph classes that are elementary in the discrete setting may exhibit nontrivial metric packing behavior.
This paper focuses on the distance-two continuous independent-set problem. In the language of ball packing, selected centers must be pairwise at distance at least 2, so the open unit balls centered at selected points do not overlap. Equivalently, following the notation of Grigoriev and Faulkner [4], this is the continuous independent-set parameter . The complete graph already reveals a new phenomenon: besides choosing original vertices, one may choose midpoints of disjoint edges. This observation suggests a connection with matching theory [2,7].
Our goal is to make this connection exact for complete multipartite graphs. Complete multipartite graphs form a natural test family because their ordinary independence number is trivial, while their continuous geometry contains many edge interiors. We prove that the optimal continuous packing is governed by a simple competition between two support mechanisms: the largest part of the multipartition and a maximum matching. The word “support” is important here: in the matching regime, midpoint configurations give canonical optima, but the theorem does not require or claim uniqueness of midpoint placement.
1.1. Main Contribution and Novelty
Let
be a complete multipartite graph with partite sets , where and . Put
The main theorem is the exact formula
This solves the continuous independent-set problem for the complete multipartite family. The proof is structural. If a feasible set contains a vertex, the metric constraints force all selected points to be vertices from a single part. If a feasible set contains no vertex, then the supporting edges of its points form a matching. These alternatives give the upper bound. The lower bound is achieved by selecting either all vertices in a largest part or, in the matching regime, the midpoints of the edges of a maximum matching. Thus the midpoint construction is used as a canonical certificate of optimality, not as a uniqueness assertion.
The result is useful for three reasons. First, it gives a closed form for a non-discrete metric packing parameter. Second, it shows precisely when the continuous parameter exceeds the ordinary independence number. Third, it yields an exact constructive algorithm that outputs not only the optimum value but also an explicit optimal configuration in the continuous graph.
1.2. Organization
Section 2 introduces the metric-graph model, continuous 1-independence, and the matching number of complete multipartite graphs. Section 3 proves the exact formula. Section 4 presents the constructive algorithm and its complexity. Section 5 gives reproducible numerical illustrations. Section 6 concludes with limitations and possible extensions.
2. Preliminaries
All graphs in this paper are finite, simple, and undirected. If is a finite graph, its continuous graph is obtained by replacing each edge by a closed interval of length one and identifying its endpoints with u and v. The distance between two points is the shortest-path distance in this metric graph and is denoted by .
Definition 1
(Continuous 1-independence). Let Γ be a continuous graph. A subset is called 1-independent if
for all distinct . The maximum cardinality of such a set is denoted by .
This convention corresponds to the radius-one ball-packing interpretation: centers are feasible exactly when their pairwise distances are at least 2. The original vertices of G are also points of , so vertex-only independent sets are allowed but are not the only possible feasible sets.
The ordinary independence number of a finite graph G is denoted by . For a complete multipartite graph ,
We also use the matching number , the maximum number of pairwise vertex-disjoint edges in G.
Lemma 1
(Matching number of a complete multipartite graph). Let with , , , and . Then
Proof.
The two upper bounds are immediate. A matching with q edges uses vertices, so . If is a largest part, then every edge incident with a vertex of must use a second endpoint outside . Since there are only vertices outside , no matching can have more than edges. Hence
We now prove attainability. If , match every vertex outside a largest part to a distinct vertex inside that largest part. This gives pairwise disjoint edges, so in this case.
It remains to consider . We claim that G has a perfect matching when N is even and a near-perfect matching when N is odd. Order the current part sizes as
While at least two nonempty parts remain, choose vertices from two largest parts and match them. Initially . Suppose that before one step the remaining total is r and the largest part has size at most . After removing one vertex from two largest parts, the new total is . The new largest part is at most
where if fewer than three parts are nonempty before the step. Clearly . If , then , hence by integrality . Since , we also have . Combining these two inequalities gives . Thus the only possible failure of the invariant occurs at the terminal stage, where at most one vertex remains and no further edge is needed. Therefore the greedy procedure continues until either zero or one vertex remains, and it constructs exactly disjoint edges.
The two cases prove the formula. □
Remark 1.
Lemma 1 is a standard special case of matching theory; see, for example, Lovász and Plummer [7]. The proof is included to make the paper self-contained and to justify the constructive algorithm used below.
3. Exact Formula
We now prove the main theorem. Before the proof, it is useful to keep three small examples in mind:
The first is governed by the largest part, the second is an equality case in which both canonical constructions have the same size, and the third is governed by a maximum matching.
Theorem 1.
Let be a complete multipartite graph with and . Put
Then
Proof.
We prove the lower and upper bounds separately.
For the lower bound, let be a largest part. If are distinct, then u and v are not adjacent, but since there exists a vertex w outside , and is a path of length 2. No shorter path exists because u and v are not adjacent. Hence , and is 1-independent in . Thus
Next let F be a matching in G, and for each let denote the midpoint of the corresponding unit interval in . If and are distinct matching edges, then they have no common endpoint. Any path from to must first travel distance from to one endpoint of e, then traverse at least one full graph edge between an endpoint of e and an endpoint of f, and finally travel distance along f to . Therefore
In a complete multipartite graph, such a path of length 2 exists unless the chosen endpoints lie in the same part; in that exceptional endpoint choice, selecting the other endpoint of one matching edge gives a different-part connection because the two edges are disjoint and each joins two different parts. Hence . The midpoint set is therefore 1-independent, and
By Lemma 1, whenever . If , then and the largest-part construction already gives the larger value. Hence
For the upper bound, let be any 1-independent set. Suppose first that S contains a vertex . Let . If x is a vertex outside , then , impossible. If x is an interior point of an edge , then at least one endpoint of is outside unless both endpoints belonged to , which is impossible because no edge lies inside one part. Choose an endpoint . Then is an edge, and
again impossible. Thus x must be a vertex in . Therefore every point of S is a vertex of , and .
Suppose next that S contains no vertex. Then every point of S lies in the interior of an edge of G. No two points of S can lie on the same edge, because their distance would be strictly less than 1. More generally, no two points of S can lie on edges sharing an endpoint. Indeed, if the two supporting edges share a vertex u, then
contradicting 1-independence. Hence the supporting edges of the points of S are pairwise vertex-disjoint; they form a matching in G. Consequently
The first case gives and the second gives . Thus every 1-independent set satisfies
Combining this with the lower bound proves the theorem. □
Proposition 1
(Support structure of feasible sets). Let be 1-independent. If S contains a vertex, then S is contained in the vertex set of a single partite class. If S contains no vertex, then the set of graph edges whose interiors contain points of S is a matching.
Proof.
Both assertions are exactly the two upper-bound cases in the proof of Theorem 1. A selected vertex excludes every edge interior and every vertex outside its own part at distance less than 2. If all selected points are interior points, two supporting edges cannot coincide or share an endpoint, because in either case the two selected points are at distance strictly less than 2 through that common edge or endpoint. □
Remark 2
(Midpoints are canonical, not unique). The matching construction in Theorem 1 uses edge midpoints because they give an immediate and uniform certificate of feasibility. Proposition 1 is intentionally weaker than a uniqueness theorem: it characterizes the supporting edges but does not claim that every matching-supported optimum must use midpoints. Depending on the multipartite structure and on the chosen matching, other interior placements may also satisfy the distance-two constraint. Conversely, arbitrary non-midpoint placements on a matching need not be feasible. Thus the correct statement is that maximum matchings provide the support of vertex-free optima, while midpoint placement is a canonical optimal realization.
Remark 3
(The edgeless one-part case). If one allows , then has no edges. With the usual convention that distinct connected components have infinite mutual distance, all isolated vertices may be selected, and the formula gives . The main proof above assumes only to avoid repeatedly separating this trivial case.
Corollary 1
(Complete graphs). For ,
Proof.
The complete graph is the complete multipartite graph , so and . Theorem 1 gives the result. □
Corollary 2
(Complete bipartite graphs). For ,
Proof.
Here and . Theorem 1 gives the claim. □
Corollary 3
(Balanced complete multipartite graphs). For and ,
In particular,
Proof.
Here and . Since , we have , and Theorem 1 gives . The ratio formula follows because . □
4. Algorithmic Construction
Theorem 1 yields an exact constructive algorithm. We call it the Exact Multipartite Continuous Independence Algorithm, abbreviated EMCIA.
For a purely numerical computation, the input is the vector of part sizes . For a labelled optimal configuration, the input must additionally specify the labelled partite sets
The algorithm returns either vertices or midpoint labels , where is an edge of G.
Proposition 2
(Correctness). Algorithm 1 returns an optimal 1-independent set of .
| Algorithm 1:Exact Multipartite Continuous Independence Algorithm (EMCIA) |
|
Proof.
If , Theorem 1 gives , and all vertices in a largest part form a 1-independent set of size M.
If , then . By Lemma 1, G has a matching of size . Moreover, the greedy priority-queue procedure used in Algorithm 1 is exactly the constructive procedure analyzed in the proof of Lemma 1; hence it outputs a maximum matching F of size . The midpoint set is 1-independent by the proof of Theorem 1, and its size is optimal. Therefore the algorithm is correct in both regimes.
□
Remark 4
(Tie handling). When , both the largest-part construction and a maximum-matching midpoint construction have optimal cardinality. Algorithm 1 returns the largest-part solution in this equality case by convention. This choice is made only to keep the pseudocode deterministic; it is not a uniqueness statement.
4.1. Complexity Analysis
Let . The numerical value
is computed by a single scan of the part-size vector. Thus the value computation runs in time and uses auxiliary memory.
For the labelled constructive version, the output can contain points, so any algorithm that writes the whole solution requires output time. In the largest-part regime, the algorithm outputs vertices. In the matching-supported regime, the priority queue has at most k elements and the algorithm performs extract/reinsert operations, each of cost . Hence the labelled constructive version runs in
time and uses memory if the output is stored. If the output is streamed, the auxiliary memory beyond the labelled input is .
Remark 5.
The bound is not intended to claim computational difficulty; it is an implementation bound for producing labelled midpoint data. Since the optimum value is available in closed form, the numerical computation itself is linear in the number of parts. If the part sizes are small integers or pre-bucketed, the greedy matching can also be implemented in linear output time.
5. Reproducible Numerical Illustrations
The theorem is exact, so the numerical section is not used as evidence for the formula. Its purpose is to visualize the two extremal regimes and the comparison between the ordinary discrete independence number and the continuous distance-two independence number.
The supplementary code package contains two Python files: emcia.py, which implements the value and constructive algorithms, and generate_experiments.py, which regenerates all CSV files and figures used in this section. The random experiment uses the fixed seed 20260610. It generates 500 complete 5-partite graphs by choosing each part size independently and uniformly from .
5.1. Balance Entropy of the Part-Size Vector
A useful quantitative way to describe the transition between the two regimes is to measure how balanced the part-size vector is. Define
and let
Here is the normalized Shannon entropy and is the effective number of substantially occupied parts. This entropy is not needed for the proof and is not a complexity-theoretic entropy; it is only a compact numerical diagnostic for the balance of the input multipartition. High entropy indicates that the vertices are spread relatively evenly among the parts, which favors the matching-supported regime. Low entropy indicates concentration in a dominant part, which favors the largest-part regime.
The exact threshold itself remains simpler than the entropy statistic: the largest-part regime occurs precisely when
whereas the matching-supported regime occurs when . The entropy statistic is therefore descriptive, not decisive; two vectors can have similar entropy but lie on different sides of the exact threshold.
Table 1.
Entropy diagnostics for selected complete multipartite instances. The normalized entropy and effective number quantify balance but do not replace the exact threshold M versus .
Table 1.
Entropy diagnostics for selected complete multipartite instances. The normalized entropy and effective number quantify balance but do not replace the exact threshold M versus .
| Graph | Exact regime | |||
|---|---|---|---|---|
| 0.714 | 0.725 | 2.217 | Largest part | |
| 0.500 | 0.946 | 2.828 | Both | |
| 0.375 | 0.985 | 2.951 | Matching-supported | |
| 0.250 | 1.000 | 4.000 | Matching-supported | |
| 0.375 | 0.997 | 2.989 | Matching-supported | |
| 0.667 | 0.784 | 2.365 | Largest part |
5.2. Selected Instances
Table 2 reports representative examples. These examples show the two possible support mechanisms and the transition case where both canonical constructions are optimal.
Figure 1.
Comparison of the largest-part value M, the matching value , and the exact continuous independence number .
Figure 1.
Comparison of the largest-part value M, the matching value , and the exact continuous independence number .

5.3. Random Complete Multipartite Graphs
Figure 2 shows the exact value of as a function of the total number of vertices N over the random instances described above. Each point is classified according to whether the optimum is attained by the largest-part construction or by the matching-supported construction.
5.4. Continuous-to-Discrete Comparison Ratio
For a complete multipartite graph, the ordinary independence number is . We therefore define the comparison ratio
This ratio equals 1 in the largest-part-dominant regime and can be larger for balanced multipartite graphs. We use the term comparison ratio rather than relaxation ratio to avoid suggesting that comes from a standard mathematical-programming relaxation of .
For the balanced family with k parts, we have and . Therefore
Figure 4 illustrates this linear growth for .
Figure 3.
Comparison ratio versus the largest part size M over the random instances.

Figure 4.
Comparison ratio for the balanced family with .

6. Conclusion
We proved an exact formula for the continuous distance-two independence number of complete multipartite graphs. The formula
shows that the optimum is governed by two support mechanisms: selecting vertices in a largest part, or using interior points supported on the edges of a maximum matching, with midpoint placement providing a canonical feasible realization. The proof also gives an exact algorithm that computes the value and constructs an optimal labelled configuration.
The method relies essentially on the complete multipartite structure. In a general graph, a vertex-containing continuous independent set need not collapse to one part, and the midpoints of two disjoint edges need not be exactly distance two apart. Thus the reduction to the maximum of a vertex-part term and a matching term is special to this graph family. This limitation also suggests possible directions for further work: identifying graph classes where continuous distance-two independence reduces to matching, deriving formulas for joins or graph blow-ups, and studying whether analogous closed forms exist for continuous vertex cover or continuous coloring parameters.
Author Contributions
Rafik Zeraoulia is the sole author of this manuscript.
Funding
The author declares that no specific funding was received for this work.
Data availability
No external datasets were used. All numerical data were generated by the Python scripts included in the supplementary code package.
Code availability
The Python implementation of EMCIA and the numerical experiment scripts are included in the supplementary code package accompanying this manuscript.
Ethical approva
Not applicable.
Consent to participate
Not applicable.
Consent for publication
Not applicable.
Conflicts of Interest
The author declares that there is no conflict of interest.
References
- Baker, M.; Norine, S. Riemann–Roch and Abel–Jacobi theory on a finite graph. Adv. Math. 2007, 215, 766–788. [Google Scholar] [CrossRef]
- Diestel, R. Graph Theory, 5th ed.; Springer: Berlin, 2017. [Google Scholar]
- Dvořák, Z. On distance r-dominating and 2r-independent sets in sparse graphs. J. Graph Theory 2019, 91, 162–173. [Google Scholar] [CrossRef]
- Grigoriev, A.; Faulkner, K. Combinatorial properties of continuous graphs: A survey of challenges, solutions and open problems. arXiv. 2025. Available online: https://arxiv.org/abs/2501.14554.
- Karp, R. M. Reducibility among combinatorial problems. In Complexity of Computer Computations; Miller, R. E., Thatcher, J. W., Bohlinger, J. D., Eds.; Plenum Press: New York, 1972; pp. 85–103. [Google Scholar]
- de Laat, D.; Vallentin, F. A semidefinite programming hierarchy for packing problems in discrete geometry. Math. Program. 2015, 151, 529–553. [Google Scholar] [CrossRef]
- Lovász, L.; Plummer, M. D. Matching Theory; North-Holland: Amsterdam, 1986. [Google Scholar]
- Luo, Y. Rank-determining sets of metric graphs. J. Comb. Theory Ser. A 2011, 118, 1775–1793. [Google Scholar] [CrossRef]
- Meir, A.; Moon, J. W. Relations between packing and covering numbers of a tree. Pac. J. Math. 1975, 61, 225–233. [Google Scholar] [CrossRef]
Figure 2.
Exact continuous independence number over 500 random complete 5-partite instances generated with seed 20260610.
Figure 2.
Exact continuous independence number over 500 random complete 5-partite instances generated with seed 20260610.

Table 2.
Exact values of for selected complete multipartite graphs.
| Graph | N | M | Extremal type | ||
|---|---|---|---|---|---|
| 7 | 5 | 3 | 5 | Largest part | |
| 8 | 4 | 4 | 4 | Both | |
| 8 | 3 | 4 | 4 | Matching-supported | |
| 8 | 2 | 4 | 4 | Matching-supported | |
| 16 | 6 | 8 | 8 | Matching-supported | |
| 15 | 10 | 7 | 10 | Largest part |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.