How this calculation works
Recover a simple graph whose square matches the supplied adjacency exactly. The result includes a root-edge witness when one exists, while a negative result requires complete bounded search.
G=H² iff uv∈E(G) exactly when1≤distance_H(u,v)≤2.A worked example
Squaring the path0–1–2–3 adds edges0–2 and1–3. The default graph therefore has a square root with those three path edges. Vertices0 and3 remain nonadjacent because their path distance is3.
Good to know
Simple undirected graph1–7 vertices. Enumerate candidate root edges only from supplied edges; at most2097152 candidates. Roots need not be unique. No weighted, directed or higher-power roots.
Squaring means distance, not matrix entry powers
The square of a simple graph connects distinct vertices whose original graph distance is one or two. It retains existing edges and adds edges for two-step paths, without retaining loops created by returning to the starting vertex.
This operation is not the entrywise square of an adjacency matrix. A matrix square counts two-step walks, whereas the graph square combines direct adjacency and existence of a two-step walk into one Boolean relation.
Compare this with the Graph minor calculator with deletion and contraction certificate. Minor contractions do not invert the graph-square operation.
The input is the proposed square
Declare the vertices and enter the edges of G, the graph you want to explain as H squared. A root H must use the same labeled vertex set. Vertex positions and drawing shapes are irrelevant to this combinatorial equality.
The calculator rejects loops and repeated unordered edges. Isolates are allowed and remain declared vertices. Because every root edge is also an edge of its square, a candidate root cannot introduce an edge absent from the supplied graph.
Enumerate admissible edge subsets completely
Every subset of the supplied edges is a possible candidate root. For each candidate, the implementation constructs its neighborhoods and compares every distinct vertex pair against the distance-at-most-two condition.
A successful candidate supplies a complete certificate that can be checked in polynomial time. If every candidate fails, the graph has no supported simple square root. The search does not approximate missing adjacencies or tolerate extra square edges.
A four-vertex path explains five edges
The path0–1–2–3 has three original edges. Two-step connections add0–2 and1–3, producing the five-edge default graph. The only missing pair0–3 has distance three in this witness.
Thus both the presence and absence of edges matter. Merely finding many two-step connections is insufficient: a candidate that also connects0 to3 would square to a different graph and must be rejected.
A root witness does not establish uniqueness
Different root graphs can sometimes have the same square. The calculator returns the first deterministic witness it encounters, rather than enumerating every root or selecting a root with a special number of edges.
If a sparse, connected or geometrically constrained explanation is required, those are additional objectives. Do not assume they follow from square-root existence. The reconstructed adjacency equality is the exact claim supported by this output.
Seven vertices keep the inverse search bounded
A graph on seven vertices can have twenty-one edges, giving at most two to the twenty-one candidate subsets. That finite limit permits a complete search with an explicit candidate counter.
Larger inverse problems need more specialized algorithms and structural results. This calculator does not promise scalable recognition, approximate network reconstruction or a root obtained by taking a numerical matrix square root.
Use the operation to explain local connectivity
Graph squares arise when observations connect items within two original steps rather than only direct neighbors. A root can propose one underlying network consistent with that interpretation, provided the observation model is exact.
Real network data can omit or add edges, in which case exact root existence may fail for measurement reasons. This page does not minimize edits or estimate which observations are wrong; it answers equality for the entered graph.
A few questions, answered
Is this a numerical adjacency-matrix square root?
No. It inverts the Boolean graph-distance operation on distinct vertices.
Can several roots exist?
Yes. The page returns one verified root rather than certifying uniqueness.
Must root edges appear in the input?
Yes. Every edge of H remains an edge of H squared.
Does No mean every candidate was checked?
Within the stated finite scope, a negative answer follows a complete candidate search.