Skip Menu |

This queue is for tickets about the Graph CPAN distribution.

Report information
The Basics
Id: 115366
Status: resolved
Priority: 0/
Queue: Graph

People
Owner: Nobody in particular
Requestors: user42_kevin [...] yahoo.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: complement keep all vertices
Date: Thu, 16 Jun 2016 22:35:25 +1000
To: bug-Graph [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
In Graph 0.9704 on moderately recent debian i386 perl 5.22.1, the complement() method doesn't keep vertices which have no edges in the resulting complement graph. I hoped it would, since the docs say "same vertices" (and since then complement(complement(g))==g). Sample program below prints "complement 0 vertices 0 edges" where I hoped "2 vertices 0 edges", retaining the two original vertices even though in the complement they both now have no edges. use strict; use Graph; my $graph = Graph->new(undirected=>1); $graph->add_edge(1, 2); print "graph $graph\n"; $graph = $graph->complement; print "complement $graph\n"; print " ", scalar($graph->vertices), " vertices ", scalar($graph->edges)," edges\n",;
Thanks, this was a straight-up bug (and an existing test was wrong). Fixed in https://github.com/neilb/Graph/commit/69c74ca2e3a64ebfddb939c3c96fcd5f2b08c0a7