Factoring a Graph in Polynomial Time

We present a polynomial-time algorithm for deciding whether a given connected graph is a non-trivial Cartesian product. The method entails first representing the graph as an isometric subgraph of a Cartesian product of graphs, then finding a suitable partition of the factors.