---
title: Maximum Cardinality Search (MCS)
url: https://www.emergentmind.com/topics/maximum-cardinality-search-mcs
type: topic
---

# Maximum Cardinality Search (MCS)

Maximum Cardinality Search (MCS) is a graph-search paradigm that iteratively selects an unchosen vertex with maximum current label, where the label at time $t$ is the number of already selected neighbors. For a finite, undirected, simple graph $G=(V,E)$ and a partial order on $V$, the Partial Search Order Problem for MCS (PSOP-MCS) asks whether there exists an MCS-ordering that is a linear extension of the given partial order. On chordal graphs, MCS has deep structural connections to perfect elimination orderings and clique graphs, and these connections underlie a polynomial-time dynamic programming algorithm for PSOP-MCS based on a layered decomposition of the clique graph [2212.04880].

## 1. Formal search model and order-theoretic formulation

Let $G=(V,E)$ be a finite, undirected, simple graph. MCS constructs an ordering $\pi=(v_1,\dots,v_n)$ iteratively. If $S_t=\{v_1,\dots,v_t\}$ is the set of already selected vertices after $t$ steps, with $S_0=\emptyset$, then the MCS label of an unchosen vertex $v$ at time $t$ is
$$
\ell_t(v)=|N(v)\cap S_t|.
$$
At iteration $t+1$, MCS selects any vertex
$$
v_{t+1}\in \arg\max_{v\in V\setminus S_t}\ell_t(v).
$$
Ties are broken arbitrarily. A linear order obtainable by this greedy rule is an MCS-ordering [2212.04880].

Equivalently, if $\sigma:V\to \{1,\dots,n\}$ encodes visit time by $\sigma(v_i)=i$, then $\sigma$ is an MCS-ordering if and only if there is a run of the greedy rule whose choices realize $\sigma$. This formulation emphasizes that MCS is not a single deterministic ordering but a family of admissible orderings induced by tie-breaking.

The partial-order variant is defined as follows. Given a search paradigm $\mathcal{S}$ and a graph $G=(V,E)$ together with a partial order $(V,\preceq)$, PSOP-$\mathcal{S}$ asks whether there exists an $\mathcal{S}$-ordering consistent with $\preceq$. For MCS, the decision problem is: given a connected graph $G=(V,E)$ and a partial order $\preceq$ on $V$, does there exist an MCS-ordering $\pi=(v_1,\dots,v_n)$ such that
$$
(u\preceq v)\Rightarrow \pi^{-1}(u)<\pi^{-1}(v)?
$$
In the terminology of the paper, the ordering then extends the partial order [2212.04880].

This formulation strictly generalizes two previously studied recognition problems. The end-vertex problem is obtained by imposing the constraint that every other vertex precede a designated vertex. The $\mathcal{F}$-tree recognition problem is also subsumed, because constraints enforcing first-predecessor choices can be encoded as partial-order constraints together with feasibility conditions.

## 2. Chordal graphs, perfect elimination, and the role of MCS

A graph is chordal if it has no induced cycle of length at least $4$. A perfect elimination ordering (PEO) of $G$ is an ordering $(v_1,\dots,v_n)$ such that for each $i$, the later neighbors of $v_i$, namely
$$
N(v_i)\cap \{v_{i+1},\dots,v_n\},
$$
form a clique. The classical characterization states that a graph is chordal if and only if it has a PEO [2212.04880].

MCS is closely tied to this characterization. On chordal graphs, MCS recognizes chordality: if one runs MCS and then checks in linear time whether the obtained ordering is a PEO, the check succeeds if and only if the graph is chordal. In the standard recognition framework, if $G$ is chordal, then any MCS-ordering is a PEO when appropriately interpreted, or equivalently the MCS-order read backward is a PEO [2212.04880].

These facts give MCS a dual status. Algorithmically, it is a search procedure driven by a local cardinality rule. Structurally, on chordal graphs it is aligned with elimination theory and clique-separator structure. The PSOP-MCS algorithm on chordal graphs relies on this alignment rather than on the label process alone.

A plausible implication is that MCS on chordal graphs is best understood not merely as a greedy vertex process but as a search whose admissible orderings reflect the decomposition of the graph into maximal cliques and separators. This perspective is made explicit through the clique-graph and Prim-ordering correspondence.

## 3. Clique graphs and the MCS–Prim equivalence

For a connected chordal graph $G$, the clique graph $C(G)$ has one node for each maximal clique of $G$. Two maximal cliques $K$ and $K'$ are adjacent in $C(G)$ if and only if $K\cap K'$ is a minimal separator between any vertex of $K\setminus K'$ and any vertex of $K'\setminus K$ in $G$. Each edge $KK'$ is labeled by the separator
$$
S=K\cap K'
$$
and weighted by $|S|$. The clique graph is the union of all clique trees of $G$, and every chordal graph has at most $|V|$ maximal cliques, so $|V(C(G))|\le |V(G)|$ [2212.04880].

Prim search on a weighted graph starts from an arbitrary node and repeatedly adds a new node through an incident edge of maximum weight to the already chosen set, with arbitrary tie-breaking. Such a node ordering is called a Prim ordering. The critical structural statement is the MCS–Prim equivalence on chordal graphs: an ordering $\sigma$ of $V(G)$ is an MCS-ordering if and only if $\sigma$ is a generation of some Prim ordering $\pi$ of the clique graph $C(G)$ [2212.04880].

More precisely, if $\pi=(K_1,\dots,K_t)$ is a Prim ordering of $C(G)$, define
$$
K(\pi,1)=K_1,\qquad
K(\pi,i)=K_i\setminus \bigcup_{j<i}K_j \quad\text{for } i\ge 2.
$$
Then any ordering of the form
$$
\sigma=\big(\overrightarrow{K(\pi,1)},\overrightarrow{K(\pi,2)},\dots,\overrightarrow{K(\pi,t)}\big),
$$
where each $\overrightarrow{K(\pi,i)}$ is an arbitrary linear order of $K(\pi,i)$, is an MCS-ordering of $G$; conversely, every MCS-ordering arises in this way from some Prim ordering of $C(G)$ [2212.04880].

This equivalence converts a constrained vertex-order problem into a constrained clique-order problem. Given a vertex partial order $R$, a Prim ordering $\pi$ of $C(G)$ respects $R$ if for each $(x,y)\in R$ one has $K_\pi^x\le_\pi K_\pi^y$, where $K_\pi^v$ denotes the first maximal $v$-clique encountered by $\pi$. There exists an MCS-ordering of $G$ extending $R$ if and only if there exists a Prim ordering of $C(G)$ respecting $R$ [2212.04880].

The significance of this bridge is algorithmic. MCS labels are dynamic and vertex-level; Prim orderings on the clique graph expose separator weights and clique-level structure. The reduction makes it possible to replace direct reasoning about all MCS tie-breakings by a structured search over maximal cliques.

## 4. Layer structure on the clique graph

The main technical notion introduced for PSOP-MCS on chordal graphs is the layer structure of the clique graph. For a weighted clique graph $C(G)$, one repeatedly removes edges of minimum weight. Fix a root maximal clique $K^\star$. After removing all minimum-weight edges, each connected component is called a unit. The units become the vertices of a unit-level graph, and two units are adjacent when some edge of $C(G)$ crosses between them. The corresponding unit edge is labeled by the common separator carried by all such crossing edges. The root unit is $U^{K^\star}$, and the layer of a unit is its distance from the root in this unit graph [2212.04880].

Several structural properties of this decomposition are used in the dynamic program.

- **Edge-label propagation**: if $UU'$ is an edge with label $S$, then every path between $U$ and $U'$ in the layer structure contains an edge labeled $S$. In particular, when two edges with the same label $S$ share this structure, the four participating units are pairwise adjacent and all six edges among them have label $S$.
- **Unique parent**: every nonroot unit in layer $i\ge 1$ is adjacent to exactly one unit in layer $i-1$, its parent. If edges inside same-layer bags are ignored, the unit graph is a rooted tree.
- **Bags within a layer**: two units in the same layer are adjacent if and only if they share the same parent and the same label to that parent. Consequently, adjacency inside a layer is an equivalence relation, and each equivalence class, called a bag, forms a clique.
- **Separator identity on unit edges**: for adjacent units $U,U'$, the edge label equals the overlap of their vertex supports,
  $$
  \mathrm{label}(UU') = V(U)\cap V(U'),
  $$
  where $V(U)=\bigcup_{K\in U}K$.
- **First-appearance unit of a vertex**: for every vertex $v\in V(G)$, there is a unique unit $U^v$ containing a maximal $v$-clique that is closest to the root, and every unit containing a maximal $v$-clique lies in the descendant subtree of $U^v$.
- **Entrance to a child bag**: if two units in the same bag have adjacent cliques in $C(G)$, then there exists a clique in the parent unit adjacent to both [2212.04880].

These statements collectively make the unit graph sufficiently tree-like for dynamic programming while retaining the separator information needed for Prim feasibility. A plausible implication is that the layer structure acts as a quotient of the clique graph that preserves precisely the information relevant to feasible MCS generations under partial-order constraints.

## 5. Reduction to rooted generic search on units

The layer structure supports a second reduction, from constrained Prim orderings of the clique graph to constrained generic search on units. Given a partial order $R$ on $V(G)$, one lifts it to a partial order on units:
$$
Q^R=\{(U^x,U^y):(x,y)\in R\},
$$
where $U^x$ is the first-appearance unit of $x$ with respect to the chosen root [2212.04880].

If there exists an MCS-ordering of $G$ starting within $K^\star$ and extending $R$, then there exists a Prim ordering of $C(G)$ starting with $K^\star$ that respects $R$. The induced order of units is then a generic-search ordering of the layer structure rooted at $U^{K^\star}$ and extending $Q^R$. Conversely, any such generic-search ordering of the layer structure can be refined unit-by-unit to a Prim ordering of $C(G)$ that respects $R$, provided one chooses for each unit an entering clique adjacent to its parent and realizes the interior of each unit appropriately [2212.04880].

The rooted generic-search feasibility lemma states that if there exists an MCS-ordering of $G$ starting with $K^\star$ and extending $R$, then there exists a rooted generic-search ordering of the layer structure starting at $U^{K^\star}$ that extends $Q^R$. The algorithm relies on Scheffler’s result that rooted PSOP for generic search is polynomial-time solvable. This result is applied at the unit level rather than on the original graph [2212.04880].

This reduction separates global and local constraints. Global precedence information is enforced through the rooted generic-search ordering of units. Local realizability inside each unit is deferred to lower levels of the dynamic program. The approach therefore converts a single difficult constrained search problem into a hierarchy of rooted feasibility problems.

## 6. Dynamic programming algorithm on chordal graphs

The main theorem is that PSOP-MCS restricted to chordal graphs is solvable in polynomial time, with overall running time $O(n^4)$, where $n=|V(G)|$ [2212.04880].

The algorithm processes the clique graph by nondecreasing separator sizes. Let the distinct edge weights of $C(G)$ be
$$
w(1)<w(2)<\dots<w(t).
$$
Define $C^{(0)}=C(G)$, and for $i=1,\dots,t$, let $C^{(i)}$ be obtained from $C^{(i-1)}$ by deleting all edges of weight $w(i)$. Each connected component of $C^{(i)}$ is again treated as a clique graph of the induced subgraph on the union of its cliques, and the connected components of $C^{(i)}$ are exactly the units of the layer structure of any component of $C^{(i-1)}$ [2212.04880].

The dynamic-programming state is
$$
D(i,H,K)=1
$$
if and only if there exists a Prim ordering of a connected component $H$ of $C^{(i)}$ that starts with the maximal clique $K\in V(H)$ and respects the restriction of $R$ to $V(H)$; otherwise $D(i,H,K)=0$.

The base case occurs at $i=t$. Then $C^{(t)}$ has isolated nodes only, so any start clique yields a trivial Prim ordering, and $D(t,H,K)=1$ for all states [2212.04880].

For the transition, to compute $D(i,H,K)$ one builds the layer structure of $H$ rooted at $K$, where the units are the connected components of $C^{(i+1)}$ contained in $H$. Let $R'=R|_{V(H)}$, and lift it to
$$
Q^{R'}=\{(U^x,U^y):(x,y)\in R'\}.
$$
If there is no generic-search ordering of the layer structure rooted at $U^K$ that extends $Q^{R'}$, then $D(i,H,K)=0$. Otherwise, fix such a unit ordering
$$
\pi_{\mathrm{units}}=(U_0=U^K,U_1,\dots,U_p).
$$
Then $D(i,H,K)=1$ if and only if both of the following hold [2212.04880]:

1. $D(i+1,U^K,K)=1$.
2. For every $j=1,\dots,p$, there exists a clique $K_j\in U_j$ such that:
   - $K_j$ is adjacent in $H$ to some clique in the parent unit of $U_j$ in the layer structure;
   - $D(i+1,U_j,K_j)=1$.

Correctness follows from concatenating local Prim orderings inside units in the order prescribed by $\pi_{\mathrm{units}}$. The entrance adjacency guarantees that when a child unit is first entered, a maximum-weight edge is available to the chosen starting clique of that unit. Respect of the lifted order $Q^{R'}$ ensures compatibility of first maximal $v$-cliques across units, while local respect inside each unit ensures compatibility with $R'$ within units [2212.04880].

The complexity analysis is based on the facts that there are $O(n^2)$ states overall and that each state requires only polynomial work: building the layer structure, solving rooted PSOP for generic search on that structure, and checking adjacency and witness cliques for child units. The resulting bound is $O(n^4)$ [2212.04880].

## 7. Scope, special cases, and limitations

The algorithmic framework crucially depends on chordality. The clique-graph representation, minimal-separator labeling, and the MCS–Prim equivalence all hold in the chordal setting and are essential to the proof. For non-chordal inputs, PSOP-MCS remains open in general. The stated procedure therefore assumes that one first tests chordality and then applies the dynamic program only in the chordal case [2212.04880].

The method solves the MCS end-vertex problem on chordal graphs as a special case, since the end-vertex question is encoded by requiring every other vertex to precede the designated terminal vertex. It also subsumes the $\mathcal{F}$-tree recognition case for MCS on chordal graphs through Scheffler’s observation that appropriate first-predecessor constraints can be encoded within PSOP [2212.04880].

An illustrative example is the graph with vertices $\{a,b,c,d\}$ and maximal cliques $K_1=\{a,b,c\}$ and $K_2=\{b,c,d\}$. Its clique graph has two nodes joined by an edge labeled $\{b,c\}$ of weight $2$. If the partial order requires $a\preceq d$, then the induced unit order is forced to place the unit of $K_1$ before the unit of $K_2$, and a respecting Prim ordering is $(K_1,K_2)$. One generated MCS-ordering is $(a,b,c,d)$, which indeed extends the constraint [2212.04880].

The paper also identifies open directions. The $O(n^4)$ bound may admit improvement through faster unit construction, more aggressive pruning in the dynamic program, or faster rooted generic-search PSOP on the layer structure. Extending the method beyond chordal graphs would require structural analogues of the clique-graph and layer decomposition framework. The data further notes that such a clean MCS–Prim equivalence does not hold for many other searches, including BFS, DFS, LexBFS, and MNS, so analogous algorithms would need different structural bridges [2212.04880].

Within the current theory, MCS on chordal graphs is therefore characterized not only by its local labeling rule but by a hierarchy of equivalent representations: perfect elimination on the graph itself, Prim orderings on the clique graph, and rooted generic-search feasibility on the layer structure. This suggests that the constrained-order behavior of MCS is controlled by separator geometry rather than by vertex labels alone.

Source: https://www.emergentmind.com/topics/maximum-cardinality-search-mcs