How this calculation works
Local complementation at a vertex toggles adjacency between every pair of its neighbors. Existing edges between those neighbors disappear, and missing ones are inserted. The chosen vertex and its own incident edges remain present throughout that operation.
Represent each labeled simple graph by active-vertex mask plus adjacency bitset. Local complementation at v toggles precisely the edges between distinct neighbors of v; retain v and its incident edges. BFS over local-complement and vertex-deletion transitions, deduplicating states. Test target isomorphism on states of matching order; store predecessor operations and final bijection. An exhaustive finite state search certifies failure; reaching the resource cap only certifies unresolved. Canonical relabeling requires transporting operation witnesses correctly.A worked example
With the prefilled inputs, exists = Yes.
Good to know
Source≤7,target≤7vertices; simplegraphs; bounded labeledstateBFS.
Reference: Primary method reference or author-maintained documentation (opens in a new tab) ↗
Local complementation changes the neighborhood edges
Local complementation at a vertex toggles adjacency between every pair of its neighbors. Existing edges between those neighbors disappear, and missing ones are inserted. The chosen vertex and its own incident edges remain present throughout that operation.
A vertex minor is obtained by a sequence of local complementations and vertex deletions. This differs from an ordinary graph minor, whose defining moves include edge contraction. Substituting contraction for local complementation would solve a different reachability problem.
Compare with the Graph minor calculator with deletion and contraction certificate. Decide a vertex-minor relation using neighborhood toggles and deletion; edge contraction graph minors define a different reachability relation.
Keep source labels until the final comparison
Use the prefilled input structure and preserve the declared column or index order. Use simple undirected graphs with no loops or repeated edges. Source and target can have different labels, because the final comparison is graph isomorphism rather than literal equality of the submitted adjacency matrices. The target cannot have more vertices than the source.
The operation list should continue to reference the original source labels. After a deletion, the remaining labels must not silently shift. A final bijection explains which surviving vertices represent the target's labels and makes the witness replayable by the reader.
Breadth-first search produces a replayable sequence
Each search state consists of its surviving vertex set and current adjacency relation. From that state, generate every legal local complementation and every single-vertex deletion, and retain a predecessor pointer when a state is first encountered.
Breadth-first traversal returns a shortest operation sequence in this chosen move system when states are handled consistently. Isomorphism deduplication can save work, but only if relabeling information is retained; otherwise a numerically correct yes-answer can still carry an invalid sequence of vertex labels.
Turn a three-vertex path into a triangle
Start with the path zero–one–two. The neighbors of vertex one are zero and two, which are initially nonadjacent. Complementing locally at one adds their edge, while the two path edges remain. The result is exactly a triangle on the same three labels.
No deletion is needed, and zero operations cannot suffice because the source has two edges while the target has three. The one-operation certificate is therefore shortest for this example. Applying the same local complementation again restores the original path.
Show the edges toggled at each step
A useful static figure places the before and after graphs side by side. Highlight the chosen vertex and draw the toggled neighbor edge differently from untouched edges. This communicates the operation itself rather than using a generic graph illustration unrelated to the result.
For longer witnesses, the accompanying table should state the operation, selected label and remaining vertex count. Replay the full sequence against the submitted source and test isomorphism to the target as a final independent certificate check.
Equivalent graphs need not have equal edge counts
Local complementation can increase or decrease the number of edges. Edge count is therefore not a monotone obstruction in this problem. Vertex count is monotone because only deletion changes it, so a larger target can be rejected immediately.
Likewise, a graph's appearance in one drawing does not indicate whether it is reachable. Layout coordinates play no role in the combinatorial operation. The engine should compare adjacency structures, including isolated vertices that would disappear if the parser inferred vertices only from edge endpoints.
A bounded search can leave reachability unresolved
The implementation accepts at most seven vertices in each input and keeps at most 150,000 labeled states, with an additional shared work budget. Reaching either limit raises an unresolved error. It does not turn a partially explored queue into a negative reachability result, nor expose an unfinished candidate sequence as a completed answer.
Test involutivity by complementing twice at the same active vertex. Test deletion bookkeeping with isolated vertices, source-to-self identity witnesses and different target labelings. These checks catch state-encoding mistakes that a single successful path-to-triangle example would miss. The public prefill uses the reverse example: a triangle as source and a three-vertex path as target. Local complementation is an involution, so the same mechanism removes one edge instead of adding it. The returned targetMap can permute labels; compare adjacency through that map rather than assuming identical vertex names.
A few questions, answered
Is a vertex minor an ordinary graph minor?
No. Vertex minors use local complementation and vertex deletion, whereas ordinary minors use vertex deletion, edge deletion and edge contraction.
Does local complementation delete the chosen vertex?
No. It changes adjacency among that vertex's neighbors. Deletion is a separate operation in the witness sequence.
Why is an isomorphism map part of the answer?
The surviving source labels can differ from the submitted target labels. The bijection makes that final correspondence explicit.
Can edge count rule out the target?
Usually not, because local complementation may add or remove edges. Target order greater than source order is a valid immediate obstruction.