Lab
Geography Playground
This demo lets you create instances of Edge Geography (both directed and undirected) where the winner is determined using the classical minimax algorithm. Further down you can find a demonstration of how it was proven that Directed Edge Geography is PSPACE-hard and thus PSPACE-complete, together with the transfer argument needed to prove hardness for the undirected variant.
What is Geography?
Geography is a two-player game played on a graph. A token starts on some vertex. On your turn, you move the token along an available edge. In Edge Geography, the traversed edge is deleted. If it is your turn and there is no legal edge to take, you lose.

This playground focuses on Edge Geography, the version studied in my first research paper. Both Directed Edge Geography and Undirected Edge Geography are PSPACE-complete in general, so one should not expect an efficient solver for arbitrary large graphs.
A polynomial space algorithm for Edge Geography
The solver is deliberately naive. It recursively evaluates positions by minimax:
- a position is losing if there are no legal moves;
- a position is winning if at least one legal move leads to a losing position;
- otherwise, it is losing.
The state is essentially:
current vertex + set of remaining edgesSo the brute-force search has exponential dependence on the number of edges. Up to polynomial factors, this is about , where . For a simple undirected graph, , so in terms of vertices this is bounded by roughly . The recursion depth of this algorithm is which is polynomial in the input size so .
Vertex mode: left-click empty space to add a vertex, left-click a vertex to choose the start, drag vertices to move them, and right-click a vertex to remove it. Edge mode: left-click two vertices to add or toggle an edge; right-click an edge to remove it.
Directed Edge Geography is PSPACE-complete
Since we have membership in PSPACE for Directed Edge Geography we must show hardness for the class to get completeness. This is done by constructing a polynomial time reduction from a known PSPACE-complete problem. The canonical PSPACE-complete problem is Quantified Boolean Formula (QBF), which is defined as follows:
A quantified Boolean formula is a Boolean formula in which every variable is bound by a quantifier. Formally, an instance consists of a formula
where each , each is a Boolean variable, and is a propositional Boolean formula over the variables , for example a formula in conjunctive normal form, as is the usual convention.
The truth value of is defined recursively as follows. If there are no quantifiers, then is true exactly when the propositional formula evaluates to true under the current assignment. Otherwise,
is true if and only if at least one of or is true, while
is true if and only if both and are true.
The decision problem QBF is:
The reduction works by turning choices of truth values into choices of graph moves. After the variables have been chosen, the graph enters a clause-checking phase. A satisfied literal gives an escape route; an unsatisfied clause traps the player.
Rigorously proving that this works and that the reduction can be constructed in polynomial time gives PSPACE-hardness of the problem.
Directed Edge Geography reduction
QBF → directed Edge Geography
The formula creates a directed graph. Variable choices consume edges, Player 2 challenges a clause, and Player 1 must point back to an already-consumed assignment branch.
Step 1 / 18 · P1 to move
Start
Player 1 starts at the beginning of the generated directed Edge Geography instance.
Undirected Edge Geography is PSPACE-complete
Now that we know that Directed Edge Geography is PSPACE-complete we can replace any directed instance with an undirected instance by using a small clever gadget which simulates a directed edge such that Player 1 wins the directed instance if and only if they win the undirected instance. For details on how this is done see Fraenkel, Scheinerman, and Ullman’s 1993 paper on Undirected Edge Geography [FSU93]. Since replacing each edge can be done in polynomial time we have that Undirected Edge Geography is PSPACE-hard and thus complete.
[FSU93] A. S. Fraenkel, E. R. Scheinerman, and D. Ullman, “Undirected edge geography,” Theoretical Computer Science 112(2):371–381, 1993. DOI: 10.1016/0304-3975(93)90026-P.