public void changeEdge(Edge edgeToRemove, EdgeState newState) {
                // If the edge does not exist then throw an error
                if (!edgeMap.containsValue(edgeToRemove)) {
                        throw new IllegalStateException("Tried to change a nonexistent edge");
                }

                // Remove the old edge
                removeEdge(edgeToRemove);

                // Get an iterator for the edges
                Iterator<Node> nodes = edgeToRemove.getAdjacent().iterator();

                // Replace the edge
                addEdge(new Edge(newState, nodes.next(), nodes.next()));

        }