Advanced maths

Graph core and minimum retract calculator with homomorphism witnesses

Find a smallest induced graph retract and return its fixed-point homomorphism certificate.

Your numbers

Valid JSON; preserve the shown array or object structure.

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

A graph homomorphism sends adjacent vertices to adjacent vertices. Several nonadjacent vertices may share an image, so it is less restrictive than an embedding. A core has no homomorphism onto a proper subgraph that preserves the graph's essential homomorphism type.

THE FORMULAEnumerate nonempty vertex subsets S in increasing cardinality. Backtrack maps f:V→S with f(s)=s for s∈S and enforce adjacency preservation for each source edge. For a successful map, retain the induced subgraph G[S] and verify every edge, all pointwise fixed vertices, and f∘f=f. Exhausting all smaller subsets proves minimal order. Count every assignment/search state; cap exhaustion is unresolved, not a negative answer. Allow disconnected and edgeless inputs; the empty graph needs an explicit separate convention.

A worked example

With the prefilled inputs, coreOrder = 2.

Good to know

Minimum induced retract; fixed vertices certify idempotence. A core is unique only up to isomorphism.

A core is a smallest homomorphically equivalent graph

A graph homomorphism sends adjacent vertices to adjacent vertices. Several nonadjacent vertices may share an image, so it is less restrictive than an embedding. A core has no homomorphism onto a proper subgraph that preserves the graph's essential homomorphism type.

For a finite graph, a minimum induced retract gives a representative of its core. The returned vertex count is canonical even when different subsets of the original labels provide isomorphic representatives. Treat the displayed labels as a witness, not as a uniquely preferred copy.

Pointwise retraction of C4 to K2Four-cycle retracts onto an edge012301r = (0, 1, 0, 1)r(r(v)) = r(v)An edge cannot retract to one loopless vertex.
Scroll across to see the full diagram.
Vertices 0 and 1 stay fixed; vertex 2 maps to 0 and vertex 3 maps to 1. Every edge maps to the retained edge, proving the two-vertex minimum.

Compare with the Graph homomorphism count calculator for two graphs. Find a smallest induced retract and its idempotent endomorphism; counting homomorphisms between two supplied graphs does not minimize the target or certify a core.

Retractions must fix their target pointwise

Use the prefilled input structure and preserve the declared column or index order. Enter a simple undirected graph using a declared vertex set and distinct unordered edges. Loops change the problem substantially: a looped target can absorb adjacent vertices. This calculator therefore uses loopless graphs and rejects self-edges instead of quietly changing their meaning.

A retraction to a subset S is a homomorphism r from the entire graph into its induced subgraph on S, with r(s)=s for every s in S. Merely finding an arbitrary homomorphism into a graph with fewer vertices does not supply this pointwise certificate.

Why increasing target size proves minimality

The exact search tries induced targets in increasing cardinality. Within a target, it assigns images to remaining vertices and rejects an assignment as soon as an edge loses adjacency. Fixed target images reduce the search without excluding a valid retraction.

When the first successful size is reached, all smaller target subsets must have been exhausted. That exhaustion supplies the minimality argument. Finding one retraction early gives an upper bound only; the page must not label it a minimum until smaller targets have been ruled out.

Retract the four-cycle onto one edge

Label a four-cycle consecutively zero through three. Keep vertices zero and one, and map the remaining vertices two and three to zero and one respectively. Each of the four source edges now maps to the retained edge, and the two retained vertices are unchanged.

The image has two vertices. A one-vertex image cannot work because a source edge would need a self-loop at its image, which the input convention forbids. Thus the minimum retract has two vertices, despite the original graph having four vertices and four edges.

Read the mapping beside the induced target

The SVG should show the original cycle and the retained edge with matching vertex labels. Use distinct line styles for original edges and mapping arrows. Drawing only the smaller graph would hide the key claim that every original edge survives under the displayed map.

A map table lets the reader verify the certificate without relying on color. Applying the retraction twice should have exactly the same result as applying it once. This idempotence follows because every image vertex lies in the subset fixed by the retraction.

Chromatic agreement is useful but insufficient

Homomorphically equivalent loopless graphs have the same chromatic number. That is a useful consistency check, but equal chromatic numbers alone do not certify equivalent homomorphism types. A minimum coloring partitions vertices into independent classes; it need not produce an induced retract of that size.

Disconnected inputs also need global treatment. One component can sometimes map into another component, making the core smaller than the union of separately computed component cores. Enumerating targets for the entire input handles such cross-component reductions directly.

Separate a complete result from a search limit

The eight-vertex input limit does not remove the need for a work budget. If its bounded assignment search is exhausted, this implementation raises an unresolved error and returns no certified core. It does not retain and display a best partial retract or an optimality interval; submit a smaller graph to obtain a completed answer.

Verify the engine on complete graphs, edgeless nonempty graphs, paths, odd cycles and disjoint unions. Complete graphs must retain every vertex; a nonempty edgeless graph retracts to one vertex. These contrasting cases exercise adjacency restrictions and pointwise fixation independently. The public prefill is the same four-cycle used here. The returned vertices identify the retained induced target, while the retraction array maps every original label into it. A smaller target without that pointwise map would not establish the requested retract certificate. Minimum induced retract; fixed vertices certify idempotence. A core is unique only up to isomorphism.

A few questions, answered

Is the graph core the same as a k-core?

No. A k-core is a degree-pruned subgraph. This calculation concerns adjacency-preserving maps and minimum retracts, so the two notions can produce very different results.

Can an adjacent pair collapse to one vertex?

Not for the loopless target convention. Collapsing the endpoints would require a loop in the target and violates adjacency preservation.

Why are two different target subsets returned on separate runs?

Different subsets can induce isomorphic copies of the same core. Their labels are witness choices; the minimum order and core isomorphism type are the invariant result.

Does a cap mean that no retract exists?

No. The identity is always a retraction. A cap means that the smallest possible image has not been completely established.

Find your calculator

Start typing to explore the library.