Advanced maths

Minimum weighted multicut calculator for terminal pairs

Find a least-cost set of undirected edges whose removal disconnects every specified terminal pair.

Your numbers

One u,v,cost row.
One pair per row; pairs need not form all combinations of one terminal set.

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 a least-cost set of undirected edges whose removal disconnects every specified terminal pair. A shared removed edge may satisfy several separation demands, which prevents solving the task by simply adding individual minimum cuts.

THE FORMULAmin Σ_(e in removed)c_e such that each entered terminal pair lies in different components of G−removed.

A worked example

On path0–1–2–3 with unit removal costs and demands(0,2),(1,3), deleting edge1–2 separates both pairs for total cost1. Cutting each demand independently and summing its answer could count unnecessary removals.

Good to know

Undirected simple graph≤10 vertices,≤20 edges,1–6 distinct-vertex terminal pairs. Nonnegative finite removal costs≤1000000. Exhaustive edge-subset search; pair-specific separation,not a demand that all terminals be mutually separated.

Several prescribed pairs share one removal set

For every listed pair, the retained graph must contain no path joining its endpoints. All pairs are checked against the same removed-edge set, so one deletion can serve more than one requirement.

This is the multicut objective. Multiway cut is a special case asking for every pair among a chosen terminal set to be separated. Here omitted terminal pairs are allowed to remain connected, and that distinction can reduce the optimal cost.

One middle edge separates two path demands0123Demands:0–2,1–3Remove edge1–2Shared cost =1
Scroll across to see the full diagram.
On path0–1–2–3 with unit removal costs and demands(0,2),(1,3), deleting edge1–2 separates both pairs for total cost1. Cutting each demand independently and summing its answer could count unnecessary removals.

Compare this with the Maximum flow minimum cut calculator for a directed graph. One source-sink cut does not solve simultaneous prescribed pair separations.

Enter removal costs rather than path lengths

Each edge cost measures the penalty for deleting that edge. It is not a travel distance, retained capacity or reward for keeping a link. The total objective sums each deleted edge cost once.

Use a consistent nonnegative cost unit and include all declared vertices, even those already isolated. A pair already disconnected in the original graph needs no additional deletion. Self-pairs are impossible separation demands and are rejected.

Evaluate connectivity after each candidate deletion

The bounded solver enumerates edge subsets, first summing their removal cost and then testing whether all terminal endpoints lie in different retained components. A feasible candidate improves the current optimum only if its cost is lower.

Candidates already no cheaper than the incumbent can be skipped because costs are nonnegative. The returned component labels provide a separate way to verify all demands, beyond trusting the displayed objective value.

One middle edge separates two path demands

The two default paths0–1–2 and1–2–3 share edge1–2. Removing that edge creates components{0,1} and{2,3}; both requested endpoint pairs fall on opposite sides.

The deletion costs one, and any nonempty removal costs at least one in this example. Since no zero-edge deletion separates the initially connected pairs, the shared middle-edge witness is optimal. Extra demands could change that conclusion.

Do not sum independent pairwise cuts

Computing a minimum cut for each pair and combining the results can choose incompatible or redundant deletions. Even if a union is feasible, it need not minimize the cost of the shared set.

Conversely, the sum of individual cut values can charge the same useful edge repeatedly. The multicut calculator optimizes the joint requirement directly; it does not present a collection of separately optimized cuts as an exact joint optimum.

Check zero costs and deterministic ties

A zero-cost edge may be removed without increasing the objective. Several distinct removal sets can therefore have the same optimum, including sets with different numbers of deleted edges.

The page minimizes total cost, not cardinality as a secondary objective. It returns one deterministic witness. Read the selected edges and components if an application also needs to minimize the number of changes or preserve specific nonterminal connections.

Apply graph separation without extra guarantees

The mathematical result can help compare which permitted link removals satisfy a separation policy. It certifies only the connectivity conditions you entered, making the omission of a relevant terminal pair a modeling error rather than a solver error.

Directed reachability, node deletions, uncertain edge failures and continuous capacities require other formulations. The finite simple-graph scope also excludes promises about large-network optimization speed or resilience under future changes.

A few questions, answered

Must every terminal be separated from every other?

No. Only the terminal pairs explicitly listed must be disconnected.

Can one deleted edge satisfy several pairs?

Yes. That shared benefit is central to the multicut objective.

Are costs distances along paths?

No. They are nonnegative penalties paid when an edge is removed.

What if a pair is disconnected already?

It imposes no additional removal requirement on the current graph.

Find your calculator

Start typing to explore the library.