public boolean exists(ArrayList<Edge> edges, Node p1, Node p2){
        boolean result = false;
        if(edges.isEmpty()) return false;
        for(Edge edge: edges){
            if((edge.a.equals(p1) && edge.b.equals(p2)) || (edge.b.equals(p1) && edge.a.equals(p2))){
                result = true;
                break;
            }
        }
        return result;
    }