[jgrapht-users] DirectedGraph equality testing
Brought to you by:
barak_naveh,
perfecthash
From: Aidan D. <ai...@on...> - 2015-08-12 21:57:50
|
Dear all, I've been trying to test for deep vertex & edge equality in a DirectedGraph. An example is below. It appears that this fails because, I think, DefaultEdge needs a non-default hashCode implementation. My GitHub pull-request is at [1], but it causes more problems than it solves. Am I just incorrect in trying to use JGraphT in this way to check graph equality? Is there some other way I should be doing this? DirectedGraph<String, DefaultEdge> g1 = new SimpleDirectedGraph<String, DefaultEdge>(DefaultEdge.class); DirectedGraph<String, DefaultEdge> g2 = new SimpleDirectedGraph<String, DefaultEdge>(DefaultEdge.class); g1.addVertex("A"); g2.addVertex("A"); assertEquals(g1, g2); g1.addVertex("B"); g2.addVertex("B"); assertEquals(g1, g2); [1] https://github.com/jgrapht/jgrapht/pull/148 -- Dr Aidan Delaney Principal Lecturer Computing, Engineering & Maths University of Brighton @aidandelaney |