Advanced maths

Graph vertex integrity calculator with an optimal deletion set

Find the vertex deletion set minimizing deletion count plus the size of the largest surviving component.

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

Find the vertex deletion set minimizing deletion count plus the size of the largest surviving component. Return the exact objective and all surviving components.

THE FORMULAvi(G)=min_{S⊆V} (|S|+max_{C component of G−S}|C|), with max∅=0.

A worked example

For the path 0–1–2–3–4, deleting {2} leaves components {0,1} and {3,4}. The objective is 1+2=3. With no deletion the score is 5, and deleting at least two vertices cannot give a score below 3.

Good to know

Simple undirected graphs with 1–14 vertices; exhaustive 2^n deletion sets. The empty residual graph has largest component size zero. No edge weights, capacities or directed connectivity; returns one optimal deletion witness.

Balance intervention and residual size

Vertex integrity combines two costs in the same vertex units: the number removed and the size of the largest component left behind. It asks how small those two quantities can be together. A separator that creates many pieces is useful only if its largest piece becomes sufficiently small.

This objective can favor a deletion set that is not a minimum vertex cut. Removing one extra vertex might reduce the largest component by several vertices and improve the total. Conversely, a cut producing many singleton pieces may still be expensive if it requires removing most of the original graph.

Deleting the middle splits the path into pairsDelete vertex 201234Largest remaining component: 20134Integrity = 1 + 2 = 3
Scroll across to see the full diagram.
For the path 0–1–2–3–4, deleting {2} leaves components {0,1} and {3,4}. The objective is 1+2=3. With no deletion the score is 5, and deleting at least two vertices cannot give a score below 3.

Compare this with the Minimum feedback vertex set calculator for a directed graph. Minimize removed vertices plus the largest surviving component size; acyclicity is not the objective.

Enter every vertex and edge

The vertex count defines labels zero through n−1, including isolated vertices. Enter each undirected edge once as two integer endpoints. Empty edge input is supported, because an edgeless graph has a meaningful integrity value. Do not remove isolates from the declared count merely to shorten the form.

The graph is simple: loops and duplicated unordered pairs are not accepted. Endpoint values must lie in the declared range. Costs and directions are outside this objective. If validation fails, edit the edge row or vertex count and calculate again; no partial deletion recommendation is carried into the corrected computation.

Work through the default path

The default path has five vertices. Removing the middle vertex 2 creates two components of size two. The deletion cost is one and the largest remaining size is two, so the displayed integrity is three. The component lists supply both halves of that arithmetic.

No deletion gives objective five. With one deletion, no remaining graph can have largest component below two, because four surviving path vertices cannot all become isolated after deleting just one vertex. With at least two deletions, any nonempty remainder contributes at least one more; deleting everything costs five.

How exhaustive evaluation proves optimality

The search evaluates all subsets of the declared vertex set. For each subset, it computes the connected components after deleting those vertices and measures the largest component. Adding the subset cardinality gives one candidate score, and the smallest candidate score becomes the result.

The empty subset and the full subset are both included. This avoids assumptions that an optimum must be a nontrivial separator. In a complete graph every partial deletion leaves a complete component, so every candidate has total n. In a disconnected graph, doing nothing may already be optimal.

Read the decomposition certificate

The removed array gives the selected intervention vertices. The components array lists the residual pieces, and largestComponent gives the largest of their sizes. Verify that the arrays are disjoint, omit exactly the removed vertices, and cover all surviving labels before interpreting the objective.

An optimal witness need not be unique. On a path, symmetric choices may produce the same score; on some graphs, doing nothing and making deletions can tie. The calculator keeps one witness rather than claiming that every listed vertex is indispensable to every optimum intervention.

Separate integrity from other objectives

Toughness divides deleted count by component count. Integrity adds deleted count to the maximum component size. Feedback vertex set asks for an acyclic remainder. These questions may select very different vertices even on the same graph, because neither the denominator nor acyclicity appears in the integrity formula.

In practical network planning, integrity is a structural summary, not a damage or cost forecast. Vertices are equally weighted, and component cardinality is the residual measure. If one vertex represents a hospital and another a minor junction, their differing importance requires a weighted model beyond this page.

Limits and boundary cases

The fourteen-vertex cap bounds the exhaustive search at 16384 deletion subsets. Component traversal adds work inside each subset. This method provides a small exact baseline with a readable certificate; it does not use a large-network approximation or a randomized estimate of the best deletion set.

For any nonempty edgeless graph, choosing no deletions yields integrity one. For a single vertex the answer is also one. When all vertices are deleted the largest residual size is defined as zero, making that candidate score n. These conventions keep all evaluated candidates mathematically consistent.

A few questions, answered

What if no vertices remain?

The largest component size is defined as 0, so the objective equals the number deleted.

Must the chosen deletion disconnect the graph?

No. Every subset is eligible, including the empty and full subsets.

Is this a minimum feedback vertex set?

No. The residual graph may contain cycles; only its largest component size enters the objective.

Can different deletion sets tie?

Yes. One optimal witness is returned, without a uniqueness claim.

Find your calculator

Start typing to explore the library.