#### Transcript Hashi Puzzles in a Graph-Theoretic Model

```Hashi in a Graph-Theoretic
Model
Ben Warren
What is Hashi?


Single-player puzzle
invented in Japan.
“Hashi” is short for the
Japanese name,
“hashiwokakero”,
meaning “build
bridges”.
The player is given a
puzzle key, and seeks
to construct a unique
solution according to
certain simple rules.
Rules of Hashi
Played on an n-by-n grid,
with some spaces
containing numbered
islands.

The goal is to connect all of
the islands with bridges
such that:

All bridges run orthogonally
between two distinct islands.
No two bridges cross.
Either 0, 1, or 2 bridges connect
any two islands.
The number of bridges incident
on an island matches that
island's number.
The final puzzle solution
connects all islands into a single
group.

Example Hashi Solution
Example Hashi Solution
Example Hashi Solution
Example Hashi Solution
Example Hashi Solution
Example Hashi Solution
Connection to Graph Theory

With some
restrictions, it
seems that hashi
keys are vertex sets
of an unknown
solution graph with
a given degree
sequence. Hashi
solutions seem to
behave like
connected planar
multigraphs.
Constructing a Model

In order to construct a model for hashi, we
have to consider the following:

The rules of hashi depend on distances
being fixed. Our model should not be
“stretchable”.

The rules of hashi also demand that
lines be strictly orthogonal. Our model
should not be “bendable”.

We would like to force planarity for all
solutions.
Definitions

A unit-distance
graph is a graph in
which all edges are
of unit length
Definitions

A grid graph is a
unit-distance graph
which is the
Cartesian product
of two unit-distance
path graphs.
Definitions

A Hanan grid graph
of a given set of
vertices is the
graph obtained
from the
intersection of all
the orthogonal
lines through each
vertex in the set.
Our Model
More simply put:


We are given a hashi grid with weighted
vertices.
We can construct a Hanan grid graph of all
possible connections between the set of
weighted vertices, such that the underlying
simple graph of the hashi solution is a
subgraph of the Hanan graph.
Our Model in Practice:

Suppos we're given
a 7x7 hashi puzzle
key:
Our Model in Practice:

We express the
puzzle key as a
7x7 weighted unitdistance grid
graph, G:
Our Model in Practice:

We construct the
Hanan grid graph
generated by the
non-zero weight
vertices of G
(indicated in blue):
Our Model in Practice:

The hashi solution
multigraph, H, has
an underlying
simple graph which
is some subgraph
of the Hanan graph
of G:
Our Model in Practice:

So, H can be
determined as a
multigraph which is
a supergraph of
some subset of the
Hanan graph of G:
Why is this model an
improvement over the
“common-sense” approach?
Why is this model an
improvement over the
“common-sense” approach?
Why not construct a better
model?


It turns out, according to Andersson(2009),
solving arbitrarily-sized hashi is an NPcomplete problem.
This is bad news for anyone looking for a
general solution to hashi.
Some notes on P vs. NP
In computer science,
there are different
“complexity classes” of
problems.

Problems in “P” can be
solved in polynomial time.

Problems in “NP” can
have their solutions
verified in polynomial
time.


All problems which are “NP-complete” are:
 In NP
 And can be reached by reducing any problem in NP.
Example problems in P

Calculating greatest common divisors

Determining if a given number is prime
Example problems in NPC

“Traveling salesman” problems.

Determining graph colorings

Sudoku

Hashi
So, why is hashi interesting?



Besides being fun, hashi is a good
“gateway” between computer science and
graph theory.
It can be expressed in the language of
either, but neither has offered a complete
picture.
As hashi keys grow in size, their
complexity compounds in a very intuitive
way.
7x7
10x10
15x15
20x20
50X50
70x70
Questions for future research:

We're given an arbitrarily-sized hashi key
whose weighted vertices generate a
Hanan graph for which all possible
solution subgraphs take the form of a tree
graph. Does this restricted case grant us
any new conclusions?
Questions for future research:


Given some small integer n, can we count
all isomorphic hashi keys and solutions
which can be generated for an nxn hashi?
Given a vertex-weighted nxn unit distance
grid graph, G, can we determine any
conditions by which G absolutely is or is
not a valid hashi key?
Citations

Wikipedia. “Hashiwokakero#Rules.” Accessed April 29, 2011.

Nikoli Co., Ltd. “Puzzle Cyclopedia”, ISBN 4-89072-406-0
