How this calculation works
Find the smallest vertex set whose pairwise shortest-path intervals cover a connected graph.
I(u,v)={w:d(u,w)+d(w,v)=d(u,v)}; g(G)=min{|S|:S ∪ ⋃u,v∈S I(u,v)=V}.A worked example
The endpoints 0 and 4 of the default five-vertex path cover every vertex, giving geodetic number two.
Good to know
Connected unweighted undirected simple graphs on 1–12 vertices. All-shortest-path intervals, selected endpoints included; singleton graph has number one. Not the strong geodetic variant with one fixed path per pair.
Coverage through shortest path intervals
A geodetic set covers a graph through shortest paths between selected vertices. For each selected pair, its interval contains every vertex that lies on at least one shortest path between those endpoints. The union of all these intervals, together with the selected vertices themselves, must cover the graph.
The objective is the smallest number of selected vertices. Coverage is not based on a physical drawing, geometric straightness or proximity to a selected point. It uses hop distances in the entered graph. Equal length alternatives all contribute, even when no single shortest route contains every covered vertex.
Compare this with the Graph metric dimension calculator with a resolving set. Find a smallest set whose pairwise shortest paths cover every vertex;resolving vertices by distinct distance signatures is a different property.
Enter a connected unweighted graph
Declare all vertices, then enter pairs of zero-based labels as undirected edges. Every edge has unit length. A missing adjacency cannot be replaced by an apparent crossing in a sketch. The input must be connected so every pair has a finite graph distance and a meaningful shortest-path interval.
Weights, loops, repeated unordered pairs and labels beyond the declared range are rejected. A graph with one vertex and no edges is connected under the convention used here. Its sole vertex must be selected, so the answer is one even though there is no pair of distinct endpoints.
Walk through the default path
The five-vertex path has endpoints zero and four. Their distance is four. For each intermediate vertex, the distance from zero to that vertex plus the remaining distance to four is also four. Therefore every vertex belongs to the interval between the two selected endpoints.
One selected vertex covers only itself under this endpoint convention and cannot cover a graph with more than one vertex. Thus two is a lower bound for the default example and the endpoint pair attains it. Any pair that omits an extreme endpoint leaves that extreme vertex uncovered.
Test interval membership with distances
The distance equality is an exact test in an unweighted graph: a shortest route from one endpoint through the tested vertex can be concatenated from shortest subroutes precisely when their lengths add to the endpoint distance. This avoids enumerating every shortest route, which could contain many equal alternatives.
The calculator computes all distances and examines vertex subsets. Each candidate begins with its selected endpoints marked covered, then adds the interval of every distinct selected pair. A fully covered subset is feasible. Exhausting smaller candidate sizes establishes the minimum instead of merely returning a plausible collection of landmarks.
Read the set and interval witnesses
The selected list identifies one minimum geodetic set. The interval records explain which vertices each selected pair covers. A vertex may occur in several intervals; that overlap is expected and is counted only once for coverage. All declared vertices must appear either as selected endpoints or in those interval lists.
The distance matrix provides a direct certificate for individual memberships. Pick an interval row and a listed vertex, then check the two-distance equality. To validate the whole witness, take the union of its interval vertices and selected endpoints. Witness feasibility alone is easy to inspect; minimality comes from the completed subset search.
Distinguish neighboring landmark concepts
Metric dimension asks whether distance signatures distinguish vertices, whereas geodetic number asks whether shortest-path intervals cover vertices. A pair of landmarks can succeed at one task and fail at the other. Neither definition can be substituted simply because both begin with the same all-pairs distance matrix.
The strong geodetic problem is also different: it fixes one shortest path for each selected pair. Here, all vertices on any shortest path for a pair contribute simultaneously. In a graph with many equal alternatives, that convention can produce a smaller selected set than the fixed-route version would permit.
Interpret ties and graph changes
The calculator returns one optimum set for graphs with at most twelve vertices. Several minimum sets may exist, and numerical vertex ordering can decide which is shown. A changed witness after relabeling does not by itself mean the invariant changed; compare the minimum cardinalities and verify the respective coverage certificates.
Adding an edge can shorten distances and remove vertices from an interval that previously covered them. Coverage therefore should be recalculated after editing adjacency, rather than assumed to improve monotonically with extra edges. This makes small before-and-after examples useful for understanding how geodetic coverage differs from ordinary graph connectivity.
A few questions, answered
Does each pair contribute just one shortest route?
No. Its interval includes vertices on any shortest route between the pair.
Is this metric dimension?
No. Metric dimension distinguishes distance signatures; geodetic number covers vertices by shortest-path intervals.
What is the one-vertex answer?
One, because the sole vertex must be selected under the endpoint convention.
Are disconnected graphs accepted?
No. This calculator requires finite pairwise distances in a connected graph.