Re: [jgrapht-developers] Adding multiple edges and loops
Brought to you by:
barak_naveh,
perfecthash
From: Barak N. <ba...@3p...> - 2004-09-20 01:39:49
|
i think it is consistent and fine.=20 here is my resoning: adding a forbidden loop is a mistake that violates the graph consistency = (if it forbid such loops). the graph should then throw an exception to "defend" = itself from begin corrupted. for a similar reason, if the user tries to "forcibly" add multiple edges = to graph that forbids multiple edges (this can be done by abusing the addEdg= e(Edge e) method) then an exception should be thrown -- the graph needs to defen= d its consistency. if this is not currently the case, it should be fixed. However, if the user attempts to add an edge which is already existing us= ing addEdge(v1,v2), then it is not a mistake. he or she wants to include the specified edge in the edge set. if the edge already in the edge set, ther= e is nothing to do. if it is not, it is included. in other words, the call ca= n satisfy the user wish, without violating any graph consistency criteria a= nd therefore there is no reason to throw an exception. is my reasoning making sense? barak -- ps: again, expect slow response until mid-october. Quoting Michael Behrisch <beh...@in...>: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > Hello, > don't you think it is inconsistent behavior to throw an exception > when trying to add a forbidden loop but simply returning null > when trying to add a multiple edge? Since the loop behavior > is not documented I think it is save to change this to returning=20 > null as well. It would very much ease the creation of random=20 > graphs I am currently working at. >=20 > Michael > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.4 (GNU/Linux) >=20 > iD8DBQFBSWnDZDyR4hR8HnQRAmQWAKCCbiSLbYUhxdlSw3GSTltJxsMmoQCfVZ7N > NlgRX8aP5mmbZN3yvcEEA5E=3D > =3DEv96 > -----END PGP SIGNATURE----- >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > jgrapht-developers mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-developers >=20 |