Hi Vernon,=20
The problem is in your implementation of class V.
The class overrides the equals() method without overriding hashCode()
method. Doing it is against the contract of equals() and hashCode() =
methods,
and it confuses the HashSet class used internally by JGraphT.
This is a mistake that almost every Java programmer does only once. I'm
saying "once" because it usually takes enough time to find, to never =
forget
about it :).
Please read CAREFULLY the documentation of equals() and hashCode():
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html
The answers are coming ... ;)
All the best,
Barak
> -----Original Message-----
> From: jgr...@li... [mailto:jgrapht-users-
> ad...@li...] On Behalf Of Vernon Smith
> Sent: Thursday, October 23, 2003 02:45
> To: jgr...@li...
> Subject: [jgrapht-users] The code
>=20
>=20
> Hi, Barak,
>=20
> The enclosed is the code for the problems I posted on JGraphT forum. =
The
> class layout is my original approach with a custom Vertex class, which =
is
> not the one in my application, but it yields the same exception. =
Please
> let me know hot to fix the problem.
>=20
> Many thinks.
>=20
> Vernon
>=20
|