Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Graph for openSUSE:Factory checked in at 2021-09-07 21:21:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Graph (Old) and /work/SRC/openSUSE:Factory/.perl-Graph.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Graph" Tue Sep 7 21:21:59 2021 rev:26 rq:917332 version:0.9723 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Graph/perl-Graph.changes 2021-07-12 21:40:00.888213780 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Graph.new.1899/perl-Graph.changes 2021-09-07 21:22:45.593400031 +0200 @@ -1,0 +2,10 @@ +Thu Sep 2 03:06:51 UTC 2021 - Tina M??ller <timueller+p...@suse.de> + +- updated to 0.9723 + see /usr/share/doc/packages/perl-Graph/Changes + + 0.9723 2021-09-01 + - doc fixes - thanks @xsawyerx + - fix problem with deep_copy with vertices that are refs - thanks @merkys for report + +------------------------------------------------------------------- Old: ---- Graph-0.9722.tar.gz New: ---- Graph-0.9723.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Graph.spec ++++++ --- /var/tmp/diff_new_pack.5KkHQq/_old 2021-09-07 21:22:46.041400572 +0200 +++ /var/tmp/diff_new_pack.5KkHQq/_new 2021-09-07 21:22:46.045400577 +0200 @@ -18,7 +18,7 @@ %define cpan_name Graph Name: perl-Graph -Version: 0.9722 +Version: 0.9723 Release: 0 Summary: Graph data structures and algorithms License: Artistic-1.0 OR GPL-1.0-or-later ++++++ Graph-0.9722.tar.gz -> Graph-0.9723.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/Changes new/Graph-0.9723/Changes --- old/Graph-0.9722/Changes 2021-07-04 13:28:14.000000000 +0200 +++ new/Graph-0.9723/Changes 2021-09-01 12:42:46.000000000 +0200 @@ -1,3 +1,7 @@ +0.9723 2021-09-01 +- doc fixes - thanks @xsawyerx +- fix problem with deep_copy with vertices that are refs - thanks @merkys for report + 0.9722 2021-07-04 - fix neighbours et al not returning count in scalar context - thanks @merkys for report diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/META.json new/Graph-0.9723/META.json --- old/Graph-0.9722/META.json 2021-07-04 13:32:12.000000000 +0200 +++ new/Graph-0.9723/META.json 2021-09-01 12:43:21.000000000 +0200 @@ -68,6 +68,6 @@ "web" : "https://github.com/graphviz-perl/Graph" } }, - "version" : "0.9722", + "version" : "0.9723", "x_serialization_backend" : "JSON::PP version 4.04" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/META.yml new/Graph-0.9723/META.yml --- old/Graph-0.9722/META.yml 2021-07-04 13:32:12.000000000 +0200 +++ new/Graph-0.9723/META.yml 2021-09-01 12:43:21.000000000 +0200 @@ -30,5 +30,5 @@ resources: bugtracker: https://github.com/graphviz-perl/Graph/issues repository: git://github.com/graphviz-perl/Graph.git -version: '0.9722' +version: '0.9723' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/lib/Graph/AdjacencyMap.pm new/Graph-0.9723/lib/Graph/AdjacencyMap.pm --- old/Graph-0.9722/lib/Graph/AdjacencyMap.pm 2021-01-10 00:48:17.000000000 +0100 +++ new/Graph-0.9723/lib/Graph/AdjacencyMap.pm 2021-09-01 12:25:11.000000000 +0200 @@ -404,6 +404,17 @@ if $a > 1 and @$k != $a; } +sub reindex { + my ($f, $a, $i2p, $m) = (@{ $_[0] }[ _f, _arity, _i ], $_[0]); + my $is_ref = $a == 1 && ($f & _REF); + my $pi = $m->[ _pi ] = {}; + for my $i ( 0..$#{ $i2p } ) { + next if !defined(my $k = $i2p->[ $i ]); # deleted + $k = __strval($k, $f) if $is_ref && ref($k); + $pi->{ $k } = $i; + } +} + 1; __END__ =pod @@ -525,6 +536,11 @@ Only valid for a map of arity other than 1. +=head2 reindex + +Will recreate the mapping from paths to indexes. Intended for use after +a deep copy. + =head1 AUTHOR AND COPYRIGHT Jarkko Hietaniemi F<j...@iki.fi> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/lib/Graph.pm new/Graph-0.9723/lib/Graph.pm --- old/Graph-0.9722/lib/Graph.pm 2021-07-04 13:28:30.000000000 +0200 +++ new/Graph-0.9723/lib/Graph.pm 2021-09-01 12:42:34.000000000 +0200 @@ -14,7 +14,7 @@ use Graph::AdjacencyMap qw(:flags :fields); -our $VERSION = '0.9722'; +our $VERSION = '0.9723'; require 5.006; # Weak references are absolutely required. @@ -133,37 +133,47 @@ @opt > 1 ? 's' : ''; } -sub new { - my ($class, @args) = @_; - my $gflags = 0; - my $vflags = 0; - my $eflags = 0; - my %opt = _get_options( \@args ); - - if (ref $class && $class->isa('Graph')) { - my %existing; - no strict 'refs'; - $existing{$_}++ for grep $class->$_, @GRAPH_PROPS_COPIED; - $existing{unionfind}++ if $class->has_union_find; - %opt = (%existing, %opt) if %existing; # allow overrides - } - - $opt{undirected} = !delete $opt{directed} if exists $opt{directed}; +sub _opt_from_existing { + my ($g) = @_; + my %existing; + $existing{$_}++ for grep $g->$_, @GRAPH_PROPS_COPIED; + $existing{unionfind}++ if $g->has_union_find; + %existing; +} - _opt(\%opt, \$vflags, +sub _opt_to_vflags { + my ($vflags, $opt) = (0, @_); + _opt($opt, \$vflags, countvertexed => _COUNT, multivertexed => _MULTI, refvertexed => _REF, refvertexed_stringified => _REFSTR , __stringified => _STR, ); + $vflags; +} - _opt(\%opt, \$eflags, +sub _opt_to_eflags { + my ($eflags, $opt) = (0, @_); + $opt->{undirected} = !delete $opt->{directed} if exists $opt->{directed}; + _opt($opt, \$eflags, countedged => _COUNT, multiedged => _MULTI, undirected => _UNORD, ); - my $is_hyper = delete $opt{hyperedged}; + ($eflags, delete $opt->{hyperedged}); +} + +sub new { + my ($class, @args) = @_; + my $gflags = 0; + my %opt = _get_options( \@args ); + + %opt = (_opt_from_existing($class), %opt) # allow overrides + if ref $class && $class->isa('Graph'); + + my $vflags = _opt_to_vflags(\%opt); + my ($eflags, $is_hyper) = _opt_to_eflags(\%opt); _opt(\%opt, \$gflags, unionfind => _UNIONFIND, @@ -195,12 +205,8 @@ $g->[ _F ] = $gflags; $g->[ _G ] = 0; - $g->[ _V ] = $vflags ? - _am_heavy($vflags, 1) : - _am_light($vflags, 1); - $g->[ _E ] = ($is_hyper or $eflags & ~_UNORD) ? - _am_heavy($eflags, $is_hyper ? 0 : 2) : - _am_light($eflags, 2); + $g->[ _V ] = _make_v($vflags); + $g->[ _E ] = _make_e($is_hyper, $eflags); $g->add_vertices(@V) if @V; @@ -214,6 +220,18 @@ return $g; } +sub _make_v { + my ($vflags) = @_; + $vflags ? _am_heavy($vflags, 1) : _am_light($vflags, 1); +} + +sub _make_e { + my ($is_hyper, $eflags) = @_; + ($is_hyper or $eflags & ~_UNORD) ? + _am_heavy($eflags, $is_hyper ? 0 : 2) : + _am_light($eflags, 2); +} + sub _am_light { require Graph::AdjacencyMap::Light; Graph::AdjacencyMap::Light->_new(@_); @@ -1118,6 +1136,11 @@ *copy_graph = \© +sub _deep_copy_best { + _can_deep_copy_Storable() + ? _deep_copy_Storable(@_) : _deep_copy_DataDumper(@_); +} + sub _deep_copy_Storable { my $g = shift; require Safe; # For deep_copy(). @@ -1139,11 +1162,9 @@ } sub deep_copy { - if (_can_deep_copy_Storable()) { - return _deep_copy_Storable(@_); # uncoverable statement - } else { - return _deep_copy_DataDumper(@_); # uncoverable statement - } + my $g2 = _deep_copy_best(@_); + $g2->[ _V ]->reindex if grep ref, &_vertices05; + $g2; } *deep_copy_graph = \&deep_copy; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/lib/Graph.pod new/Graph-0.9723/lib/Graph.pod --- old/Graph-0.9722/lib/Graph.pod 2021-03-13 17:41:42.000000000 +0100 +++ new/Graph-0.9723/lib/Graph.pod 2021-09-01 12:34:54.000000000 +0200 @@ -175,6 +175,10 @@ functionality uses either Storable or Data::Dumper behind the scenes, depending on which is available (Storable is preferred). +If your vertices are references, the copied graph will have its +connections fixed up. Support for this is new as of 0.9723, so please +report any problems. + =item undirected_copy =item undirected_copy_graph @@ -927,7 +931,7 @@ $g->is_strongly_connected -For a directed graph, return true is the directed graph is strongly +For a directed graph, return true if the directed graph is strongly connected, false if not. See also L</is_weakly_connected>. @@ -986,7 +990,7 @@ $g->is_weakly_connected -For a directed graph, return true is the directed graph is weakly +For a directed graph, return true if the directed graph is weakly connected, false if not. Weakly connected graph is also known as I<semiconnected> graph. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/t/65_ref.t new/Graph-0.9723/t/65_ref.t --- old/Graph-0.9722/t/65_ref.t 2021-01-10 00:48:17.000000000 +0100 +++ new/Graph-0.9723/t/65_ref.t 2021-09-01 12:26:06.000000000 +0200 @@ -2,7 +2,7 @@ use Test::More; use Graph; -use Graph::AdjacencyMap qw(:flags); +use Graph::AdjacencyMap qw(:flags :fields); use Graph::AdjacencyMap::Light; use Math::Complex; @@ -51,6 +51,11 @@ is( $m->${ \$map->{has} }(@$path_maybe_id), undef, $label ); $got = [ $m->${ \$map->{set} }(@$path_maybe_id) ]; is_deeply( $got, [ 0, $is_multi ? $maybe_id : () ], $label ) or diag explain $got; + if ($args->[0] == _REF) { + my $m2 = Graph::_deep_copy_best($m); + $m2->reindex; + isnt( $m2->${ \$map->{has} }($m2->[ _i ][0]), undef, $label ); + } is $m->_set_path_attr(@$path_maybe_id, 'say', 'hi'), 'hi', $label; ok $m->_has_path_attrs(@$path_maybe_id), $label; ok $m->_del_path_attrs(@$path_maybe_id), $label; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9722/t/67_copy.t new/Graph-0.9723/t/67_copy.t --- old/Graph-0.9722/t/67_copy.t 2021-01-06 00:22:03.000000000 +0100 +++ new/Graph-0.9723/t/67_copy.t 2021-09-01 12:39:56.000000000 +0200 @@ -1,5 +1,5 @@ use strict; use warnings; -use Test::More tests => 42; +use Test::More; use Graph::Directed; use Graph::Undirected; @@ -114,3 +114,13 @@ my $c = $g->_deep_copy_DataDumper; is($c->get_graph_attribute('color')->(3), 81); } + +my $edges = [[{ name => 'A' }, { name => 'B' }]]; +SKIP: { + my $orig = Graph::Undirected->new(refvertexed=>1, edges=>$edges); + for my $g ($orig, $orig->deep_copy) { + is scalar $g->neighbours( $_ ), 1, 'still linked up' for $g->vertices; + } +} + +done_testing;