Advanced maths

Maximum induced matching calculator from a graph edge list

Select as many edges as possible so that their endpoints induce exactly those selected edges.

Your numbers

Vertices are labeled 0 through n−1, including isolated vertices.
One edge per line: u,v. No loops or duplicate pairs. Blank means no edges.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Select as many edges as possible so that their endpoints induce exactly those selected edges. Return the exact maximum induced matching, selected edge indices and endpoint witness.

THE FORMULAM⊆E is induced iff distinct edges in M are vertex-disjoint and no original edge joins their endpoint sets; maximize |M|.

A worked example

For the path 0–1–2–3–4, select edges 0–1 and 3–4. Their endpoint set {0,1,3,4} induces exactly those two edges, so the maximum is 2. At most floor(5/2)=2 vertex-disjoint edges can exist.

Good to know

Simple undirected graphs with 1–14 vertices and at most 30 edges. Exact conflict-graph include/exclude search; 2000000-state cap throws unfinished error. Objective counts edges. No weighted objective or claim about ordinary maximum matching.

Require separation between matched edges

An ordinary matching prevents selected edges from sharing endpoints. An induced matching also forbids every additional original edge joining the endpoints of different selected edges. Equivalently, the subgraph induced by all selected endpoints must consist of isolated two-vertex edges and nothing else.

This stronger condition represents separation between chosen pairs. It does not forbid outside vertices from touching several selected endpoints, because those outside vertices are not in the induced endpoint set. Confusing these two requirements would unnecessarily reject valid induced matchings and solve a different packing problem.

Separated end edges form an induced matchingEndpoint-induced subgraph contains only selected edges01234Selected pairs: {0,1} and {3,4}Vertex 2 lies outside the selected endpoint set
Scroll across to see the full diagram.
For the path 0–1–2–3–4, select edges 0–1 and 3–4. Their endpoint set {0,1,3,4} induces exactly those two edges, so the maximum is 2. At most floor(5/2)=2 vertex-disjoint edges can exist.

Compare this with the Maximum weight matching calculator for a general graph. Select disjoint edges whose endpoints induce exactly the selected edges; ordinary matching allows extra cross-edges.

Enter the undirected edge set

Declare one to fourteen vertices and list at most thirty undirected edges, one endpoint pair per row. Labels begin at zero. Isolated vertices may be declared even though they cannot serve as endpoints of selected edges; they remain relevant to the complete graph description.

The graph is simple and unweighted. Loops, reversed duplicate edges, out-of-range labels, fractional endpoints and extra columns are rejected. Correct an invalid row and calculate again. The page rebuilds all edge conflicts from the corrected graph, including conflicts caused by edges that are never themselves selected.

Check the five vertex path

The default path has edges 0–1, 1–2, 2–3 and 3–4. Choosing the first and last edges uses endpoints {0,1,3,4}. No original edge joins either of the first edge’s endpoints to an endpoint of the last edge, so this pair is induced.

The middle vertex 2 is outside the endpoint set. Its connections to 1 and 3 do not invalidate the pair. The result has size two, and no matching on five vertices can contain three disjoint edges because each selected edge requires two distinct endpoints. This proves optimality directly for the example.

Build the edge conflict relation

Treat each original edge as a candidate item. Two candidates conflict when they share an endpoint or when any original graph edge joins one endpoint of one candidate to an endpoint of the other. A feasible induced matching is then a set of mutually nonconflicting candidate items.

The program computes this conflict relation once and searches candidate subsets by including or excluding a chosen edge. Including it removes every conflicting candidate. Excluding it removes only itself. These two branches exhaust all possible solutions and explain why a normal matching algorithm cannot enforce the extra induced condition by itself.

Read the optimum certificate

The selectedEdges array contains original endpoint pairs, and edgeIndices refers to their positions in the entered edge sequence. The endpoints list allows a direct induced-subgraph check. Its length must be twice the reported matching size, with no duplicate vertex labels anywhere in the list.

Next examine every original edge whose two endpoints both lie in that list. It must be one of the selected edges. Any extra such edge would violate inducedness even if it was not selected. Multiple maximum solutions may exist, so edge order can influence the returned witness while preserving the optimum size.

Understand bounds and unfinished search

The exact branch search maintains a best completed solution. If the number already chosen plus the number of remaining candidate edges cannot beat that solution, the branch is safely discarded. This cardinality upper bound is simple but valid, preserving exactness whenever the full search completes.

The state limit is two million recursive calls. Reaching it raises an unfinished-search error instead of returning the current best as a proven maximum. A partial packing would establish only a lower bound. A completed empty result, in contrast, is exact for a graph with no edges.

Compare related matching questions

On a four-vertex path, an ordinary matching can choose the first and last edges, but those endpoints induce the middle connecting edge as well. Its maximum induced matching therefore has size one even though its ordinary maximum matching has size two. This is a useful diagnostic example.

The linked research discusses exact induced-matching algorithms for a restricted graph class. This calculator uses a general bounded conflict search and does not claim that specialized running-time bound. It does not maximize total weight, impose distances beyond inducedness or compute a strong edge coloring, although these subjects share related conflict structures.

A few questions, answered

How is induced matching stronger than matching?

It also forbids edges joining endpoints of different selected edges.

Can an outside vertex touch several selected edges?

Yes. Only edges inside the selected endpoint set affect inducedness.

Does edge order change the optimum?

No. It can change which tied optimum witness is returned.

What does an unfinished-search error prove?

It proves only that the resource cap was reached, not that the current best packing is maximum.

Find your calculator

Start typing to explore the library.