RE: [jgrapht-developers] edge ownership
Brought to you by:
barak_naveh,
perfecthash
From: Barak N. <bar...@us...> - 2003-10-07 08:20:40
|
> What is the reason for the edge ownership exclusivity? Allowing edges > to be aliased in more than one graph is generally useful (especially = if > they have some additional information associated with them). And view > graphs like SubGraph and AsUndirectedGraph implicitly violate the > ownership rule. That indeed useful and works well as long as no one implements an Edge = that allows setSource() or setTarget(), that can mess up the graph internals. = On the other hand, if total immutability of the edges was required as part = of the contract of Edge, then we loose much of the advantage of the = sharing.=20 In order to protect the graph integrity, I have firstly implemented a = hard rule that "only the graph creates its edges" to allow it to promise the source and target could not be modified (externally). That's why in = previous versions of Graph there was no addEdge(Edge) method.=20 That proved to be too restrictive, so I relaxed it a bit later, but I = still don't have a complete and coherent solution in mind, what will settle = all the (seemingly) contradicting requirements.=20 Any ideas? Barak=20 |