-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
On Thursday 19 July 2007 19:07:07 jhi@iki.fi via RT wrote:
Show quoted text[snip]
Show quoted text> > > If I run your test case no spurious second edge gets created?
> >
> > Maybe it depends on the hash-insertion/randomness order?
>
> It's possible. Oh, how I wish the randomized hashes had been the
> default from very beginning...
>
> > Have you uncommented the two commented lines? (Sorry, the version I
> > posted
>
> Ahhh, no. I'll retry tonight.
Have you had a chance to look into this? I encountered the same (a
similiar?) bug with multi-edged undirected graphs. Here adding two edges
like so:
my $id = $out->add_edge_get_id($from,$to);
my $attr = $e->raw_attributes();
$out->set_edge_attributes_by_id($from, $to, $id, $attr);
can result in _four_ edges. The only remedy I found was that in case of
undirected graphs, to _always_ swap $from and $to so that they are in the
same predetermined order (basically sorting the $from and $to objects by
some global unique ID) like so:
if ($opt->{undirected})
{
# swap the arguments to avoid creating a spurious edge
($from,$to) = ($to,$from) if $e->{to}->{id} < $e->{from}->{id};
}
my $id = $out->add_edge_get_id($from,$to);
my $attr = $e->raw_attributes();
$out->set_edge_attributes_by_id($from, $to, $id, $attr);
This means, however, that the input graph:
Berlin -- Bonn
Berlin -- Bonn
might result in:
Bonn -- Berlin
Bonn -- Berlin
e.g. the original sorting order of the nodes on the edges was lost (although
one can argue that with a true undirected graph this shouldn't matter).
I can send in a testscript that demonstrates the problem with multi-edged
graphs, if you want.
All the best,
Tels
- --
Signed on Sat Jul 28 12:24:49 2007 with key 0x93B84C15.
Get one of my photo posters:
http://bloodgate.com/posters
PGP key on
http://bloodgate.com/tels.asc or per email.
"Q: What do you get when you cross an insomniac, an agnostic, and a
dyslexic?
A: Someone who stays up all night wondering if there is a
Dog."
-- Groucho Marx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iQEVAwUBRqsahXcLPEOTuEwVAQJWAgf8Db7szTuFQfXS11lwUD5NTTNLcBWYVZ1j
Tv/FlIsqhvUBNi/ovQpvVgGHRDdXNsprdaYezae+1NAtPKfkUrzNff15hWl49ch6
RGHMdnwD40NOvMkJI2JeJxtEETkaUvkYSDk/nre0xnKeAtH4pzi1rrLVovbGMk7f
PladXT/TV9RYISwpQh+Fl4awEJ8Dwk4f+n1BJYAAFu7gN9OTN+tMCaaD89alPZel
8M0Z9H+WguE3QF0bkDj5c7uQ5g1mBMPGyFYRq24bYCwLnb8bJ1l5Swvy1aEmGhkx
ic2bKm7lC2S6dLbSra9XHU/ifFN42tjMbZ98r5hA40nNUIc6OYMEfA==
=h576
-----END PGP SIGNATURE-----