//get the vertex of the given state.
public Vertex getVertex(InspectableGraph graph, Object state)
{
VertexIterator itr = graph.vertices();
while (itr.hasNext()) {
Vertex v = itr.nextVertex();
if (v.element().equals(state))
return v;
}
return null;
}