Advanced maths

Exact graph rank width calculator with a decomposition tree

Compute exact rank width of a small simple graph and return a leaf decomposition with GF2 cut-rank witnesses.

Your numbers

Labels are 0 through n−1; include isolated vertices.
One row: u v. No loops or duplicate unordered 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

Compute exact rank width of a small simple graph and return a leaf decomposition with GF2 cut-rank witnesses.

THE FORMULAρ(A)=rankGF(2) A[A, V\A]; rw(G)=minT maxe ρ(Ae).

A worked example

The default five-cycle has rank width 2; a returned decomposition displays cut matrices with maximum rank 2.

Good to know

Simple undirected graph on 1–10 vertices; complete subset dynamic program over binary leaf decompositions. GF2 ranks use XOR elimination, not real rank. The singleton convention is 0; no heuristic width is presented as an exact optimum.

A width based on binary adjacency

Rank width measures how complicated graph connections become across cuts in a decomposition tree. For a vertex subset A, form the adjacency matrix between A and its complement. Its rank is taken over the two-element field, so addition is exclusive-or rather than ordinary real addition.

A rank decomposition has the graph vertices at the leaves of a subcubic tree. Removing one tree edge divides those leaves into two parts and supplies a graph cut. The width of the decomposition is the largest binary adjacency rank among its edge cuts; graph rank width is the smallest attainable width.

A five-cycle needs a rank-two cut01234Cut ranks over GF2Maximum witness rank = 2Exact rank width = 2
Scroll across to see the full diagram.
The width counts independent binary adjacency patterns across decomposition cuts, not the number of crossing edges.

Compare this with the Exact treewidth calculator with a tree decomposition. Minimize GF2 adjacency cut ranks over subcubic leaf decompositions, rather than bag size or an elimination fill objective.

Why treewidth is a different number

Treewidth counts vertices in overlapping bags of a tree decomposition. Rank width instead measures binary dependence among cross-cut adjacency rows. A dense connection pattern can have small binary rank even when many individual vertices or edges cross the cut, so neither the bag size nor the edge count is the same objective.

This distinction matters in graphs with repeated neighborhoods. Several cross-cut rows can be identical or exclusive-or combinations of others, reducing rank without removing their edges. The calculator retains the full adjacency relation but counts independent binary patterns when evaluating each decomposition cut.

The five-cycle worked example

The default input is the cycle on five vertices. Across any cut, only the adjacency between the selected side and the remaining vertices enters the matrix. A suitable leaf decomposition has a largest cut rank of two, and the complete search confirms that width one is unattainable.

The returned hierarchy is one optimal decomposition rather than a unique canonical tree. Its cut table names each selected vertex side and the corresponding GF2 rank. Inspecting those sides makes the reported width reproducible without relying on the visual shape of an arbitrary drawing of the cycle.

Computing a cut rank

Each matrix row is represented by the neighbors of one selected vertex that lie outside the subset. Gaussian elimination uses bitwise exclusive-or to remove occupied pivots. A newly independent pivot increases the rank; a row reduced to zero adds no new binary direction.

The rank is symmetric between a subset and its complement because the two cut matrices are transposes. Edges lying entirely on one side do not appear in that cut matrix. They still matter in other cuts, so this local omission is part of the definition rather than a deletion from the input graph.

The complete subset recurrence

For each nonempty subset, the dynamic program considers splitting its leaves into two nonempty children. A candidate cost is the maximum of both child costs and the current subset's cut rank. Taking the minimum over every split computes the best possible rooted binary hierarchy on that subset.

The root contains every vertex and has cut rank zero. Suppressing its degree-two root produces the usual subcubic unrooted leaf tree without changing the meaningful cut ranks. Enumerating all subset splits gives an exact finite recurrence, not a greedy choice of a promising decomposition followed by an optimistic label.

Reading the decomposition certificate

A leaf record contains an original vertex index; an internal record contains its leaf side and two children. The cut table excludes the full root side and reports the ranks encountered on the hierarchy. The largest certificate rank must agree with the returned width, except that a singleton has no tree-edge cuts and uses width zero.

The tree proves an upper bound by construction. Exact optimality additionally relies on completing the subset recurrence over all possible splits. Independent checks in this batch enumerate small unrooted binary tree topologies directly, providing a different route to the same minima on reference examples.

Bounds before using the result

The number of subsets and bipartitions grows exponentially, so the calculator is deliberately limited to small graphs. It accepts isolated or disconnected vertices and does not replace them with a connected component assumption. Directed, weighted or multigraph notions of cut rank are outside this page's model.

When comparing results, confirm the field and the singleton convention. Using ordinary real matrix rank can change a cut value, and using linear rank width restricts the decomposition shape to a path-like ordering. Those are meaningful different calculations, not merely alternative spellings of the exact rank width returned here.

A few questions, answered

Which field is used for rank?

GF2, the two-element field, with exclusive-or row addition.

Is rank width the same as treewidth?

No. It measures adjacency cut ranks rather than decomposition bag sizes.

Why is the output a nested tree?

It records the binary leaf decomposition whose cuts certify the returned upper bound.

Is this a heuristic decomposition?

No. Within the stated vertex bound the subset recurrence considers every split and computes the exact minimum.

Find your calculator

Start typing to explore the library.