Re: [jgrapht-users] Bug in removeAllEdges?
Brought to you by:
barak_naveh,
perfecthash
From: John V. S. <js...@gm...> - 2006-11-26 14:34:31
|
Trevor Harmon wrote: > Well, that part I would still say is a bug. I could understand it if > outgoingEdgesOf, incomingEdgesOf, and edgesOf all ended up causing the > ConcurrentModificationException -- at least that would be consistent. > But that's not the case here. The behavior of an API shouldn't be left > to chance. :) Go ahead and create a bug report for this inconsistency. It may not get addressed for a while because the fix isn't trivial. For a directed graph, edgesOf has to be computed on the fly by combining the incoming and outgoing edge sets of the vertex. And that computation isn't something that's easy to express as a derived Set implementation, due to the requirement to filter out the duplicates for self-loops. So the fix requires us to maintain a graph-level timestamp which can be used by ArrayUnenforcedSet to detect the ConcurrentModificationException. One side-effect of the fix would be that any application code which is currently relying on the buffering behavior of edgesOf would break. But in this case, a more consistent and less surprising API trumps backward-compatibility. JVS |