Use equal vertex in a JGraphT SimpleGraph
问题 In Java, want to create a simple graph (a unweighted, undirected graph containing no graph loops or multiple edges) containing vertexes/edges that are equal. I have two Java Classes, one for the vertexes: class Vertex { private int field; public Vertex(int field) { this.field = field; } @Override public boolean equals(Object obj) { if (obj.getClass().getPackage() .equals(this.getClass().getPackage()) && obj.getClass().getName() .equals(this.getClass().getName())) { Vertex vertex = (Vertex)