private boolean containsEdge(Graph<Node> graph, Node source, Node target) {
    Iterator<Node> successors = graph.getOut(source);
    while (successors.hasNext()) {
      Node successor = successors.next();
      if (successor.equals(target)) {
        return true;
      }
    }
    return false;
  }
private boolean containsEdge(Graph<Node> graph, Node source, Node target)