Hello community, here is the log from the commit of package perl-Graph for openSUSE:Factory checked in at 2020-11-23 15:49:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Graph (Old) and /work/SRC/openSUSE:Factory/.perl-Graph.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Graph" Mon Nov 23 15:49:54 2020 rev:17 rq:850148 version:0.9709 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Graph/perl-Graph.changes 2020-11-09 13:59:19.735713186 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Graph.new.5913/perl-Graph.changes 2020-11-23 18:54:57.077638723 +0100 @@ -1,0 +2,12 @@ +Mon Nov 23 03:06:15 UTC 2020 - Tina Müller <timueller+p...@suse.de> + +- updated to 0.9709 + see /usr/share/doc/packages/perl-Graph/Changes + + 0.9709 2020-11-22 + - add path_count option to TransitiveClosure + - get_{edge,vertex}_attributes undef if no such entity, in list context + - as_hashes method + - ingest method + +------------------------------------------------------------------- Old: ---- Graph-0.9708.tar.gz New: ---- Graph-0.9709.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Graph.spec ++++++ --- /var/tmp/diff_new_pack.mEbIIn/_old 2020-11-23 18:54:57.677639330 +0100 +++ /var/tmp/diff_new_pack.mEbIIn/_new 2020-11-23 18:54:57.677639330 +0100 @@ -17,7 +17,7 @@ Name: perl-Graph -Version: 0.9708 +Version: 0.9709 Release: 0 %define cpan_name Graph Summary: Graph data structures and algorithms ++++++ Graph-0.9708.tar.gz -> Graph-0.9709.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/Changes new/Graph-0.9709/Changes --- old/Graph-0.9708/Changes 2020-11-06 22:53:18.000000000 +0100 +++ new/Graph-0.9709/Changes 2020-11-22 20:16:27.000000000 +0100 @@ -1,3 +1,9 @@ +0.9709 2020-11-22 +- add path_count option to TransitiveClosure +- get_{edge,vertex}_attributes undef if no such entity, in list context +- as_hashes method +- ingest method + 0.9708 2020-11-06 - update metadata for Test::More version dep - stringify hypervertices right @@ -482,7 +488,7 @@ affect the result graph but it of course affected the resulting vertex 'weight' attributes. - - Add tests to t/70_spt.t for the vertex and egde attributes + - Add tests to t/70_spt.t for the vertex and edge attributes of the SPT_Dijkstra() and SPT_Bellman_Ford() results. - Minor documentation tweaks, most importantly clarify the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/META.json new/Graph-0.9709/META.json --- old/Graph-0.9708/META.json 2020-11-06 22:53:59.000000000 +0100 +++ new/Graph-0.9709/META.json 2020-11-22 20:18:08.000000000 +0100 @@ -4,7 +4,7 @@ "Jarkko Hietaniemi <j...@iki.fi>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.54, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -47,6 +47,9 @@ } }, "test" : { + "recommends" : { + "App::Prove" : "3.00" + }, "requires" : { "Math::Complex" : "0", "Test::More" : "0.82" @@ -56,14 +59,14 @@ "release_status" : "stable", "resources" : { "bugtracker" : { - "web" : "https://github.com/neilb/Graph/issues" + "web" : "https://github.com/graphviz-perl/Graph/issues" }, "repository" : { "type" : "git", - "url" : "git://github.com/neilb/Graph.git", - "web" : "https://github.com/neilb/Graph" + "url" : "git://github.com/graphviz-perl/Graph.git", + "web" : "https://github.com/graphviz-perl/Graph" } }, - "version" : "0.9708", + "version" : "0.9709", "x_serialization_backend" : "JSON::PP version 4.00" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/META.yml new/Graph-0.9709/META.yml --- old/Graph-0.9708/META.yml 2020-11-06 22:53:59.000000000 +0100 +++ new/Graph-0.9709/META.yml 2020-11-22 20:18:08.000000000 +0100 @@ -9,7 +9,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.54, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,7 +27,7 @@ Storable: '2.05' perl: '5.006' resources: - bugtracker: https://github.com/neilb/Graph/issues - repository: git://github.com/neilb/Graph.git -version: '0.9708' + bugtracker: https://github.com/graphviz-perl/Graph/issues + repository: git://github.com/graphviz-perl/Graph.git +version: '0.9709' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/Makefile.PL new/Graph-0.9709/Makefile.PL --- old/Graph-0.9708/Makefile.PL 2020-11-06 16:34:57.000000000 +0100 +++ new/Graph-0.9709/Makefile.PL 2020-11-09 20:29:14.000000000 +0100 @@ -20,6 +20,7 @@ $PREREQ_PM{'Safe' } = 0, } +my $repo = 'graphviz-perl/Graph'; WriteMakefile( NAME => 'Graph', VERSION_FROM => 'lib/Graph.pm', @@ -41,11 +42,11 @@ : (META_MERGE => { 'meta-spec' => { version => 2 }, resources => { - bugtracker => { web => 'https://github.com/neilb/Graph/issues' }, + bugtracker => { web => "https://github.com/$repo/issues" }, repository => { type => 'git', - web => 'https://github.com/neilb/Graph', - url => 'git://github.com/neilb/Graph.git', + web => "https://github.com/$repo", + url => "git://github.com/$repo.git", }, }, prereqs => { @@ -60,6 +61,9 @@ 'Test::More' => '0.82', # explain 'Math::Complex' => 0, }, + recommends => { + 'App::Prove' => '3.00', # prove -j4 + }, }, }, }) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/lib/Graph/TransitiveClosure/Matrix.pm new/Graph-0.9709/lib/Graph/TransitiveClosure/Matrix.pm --- old/Graph-0.9708/lib/Graph/TransitiveClosure/Matrix.pm 2020-10-31 22:35:37.000000000 +0100 +++ new/Graph-0.9709/lib/Graph/TransitiveClosure/Matrix.pm 2020-11-21 00:04:27.000000000 +0100 @@ -7,7 +7,7 @@ use Graph::Matrix; sub _new { - my ($g, $class, $opt, $want_transitive, $want_reflexive, $want_path, $want_path_vertices) = @_; + my ($g, $class, $opt, $want_transitive, $want_reflexive, $want_path, $want_path_vertices, $want_path_count) = @_; my $m = Graph::AdjacencyMatrix->new($g, %$opt); my @V = $g->vertices; my $am = $m->adjacency_matrix; @@ -124,6 +124,8 @@ if ($want_path && !$want_transitive) { for my $w (@V) { my $aiw = $ai{$w}; + my $diw = $di{$w}; + $didiv->[$diw] ||= 0 if $want_path_count; # force defined next unless # See XXX above. # $am->get($v, $u) @@ -133,7 +135,10 @@ # $am->get($u, $w) vec($aiaiu, $aiw, 1) ; - my $diw = $di{$w}; + if ($want_path_count) { + $didiv->[$diw]++ if $w ne $u and $w ne $v and $u ne $v; + next; + } my ($d0, $d1a, $d1b); if (defined $dm) { # See XXX above. @@ -189,49 +194,27 @@ sub new { my ($class, $g, %opt) = @_; my %am_opt = (distance_matrix => 1); - if (exists $opt{attribute_name}) { - $am_opt{attribute_name} = $opt{attribute_name}; - delete $opt{attribute_name}; - } - if ($opt{distance_matrix}) { - $am_opt{distance_matrix} = $opt{distance_matrix}; - } - delete $opt{distance_matrix}; - if (exists $opt{path}) { - $opt{path_length} = $opt{path}; - $opt{path_vertices} = $opt{path}; - delete $opt{path}; - } - my $want_path_length; - if (exists $opt{path_length}) { - $want_path_length = $opt{path_length}; - delete $opt{path_length}; - } - my $want_path_vertices; - if (exists $opt{path_vertices}) { - $want_path_vertices = $opt{path_vertices}; - delete $opt{path_vertices}; - } - my $want_reflexive; - if (exists $opt{reflexive}) { - $want_reflexive = $opt{reflexive}; - delete $opt{reflexive}; - } - my $want_transitive; - if (exists $opt{is_transitive}) { - $want_transitive = $opt{is_transitive}; - $am_opt{is_transitive} = $want_transitive; - delete $opt{is_transitive}; - } + $am_opt{attribute_name} = delete $opt{attribute_name} + if exists $opt{attribute_name}; + $am_opt{distance_matrix} = delete $opt{distance_matrix} + if $opt{distance_matrix}; + $opt{path_length} = $opt{path_vertices} = delete $opt{path} + if exists $opt{path}; + my $want_path_length = delete $opt{path_length}; + my $want_path_count = delete $opt{path_count}; + my $want_path_vertices = delete $opt{path_vertices}; + my $want_reflexive = delete $opt{reflexive}; + $am_opt{is_transitive} = my $want_transitive = delete $opt{is_transitive} + if exists $opt{is_transitive}; die "Graph::TransitiveClosure::Matrix::new: Unknown options: @{[map { qq['$_' => $opt{$_}]} keys %opt]}" if keys %opt; $want_reflexive = 1 unless defined $want_reflexive; - my $want_path = $want_path_length || $want_path_vertices; + my $want_path = $want_path_length || $want_path_vertices || $want_path_count; # $g->expect_dag if $want_path; _new($g, $class, \%am_opt, $want_transitive, $want_reflexive, - $want_path, $want_path_vertices); + $want_path, $want_path_vertices, $want_path_count); } sub has_vertices { @@ -391,6 +374,14 @@ By using true for C<path_vertices> also the paths will be computed, they can be retrieved using the path_vertices() method. +=item path_count => boolean + +As an alternative to setting C<path_length>, if this is true then the +matrix will store the quantity of paths between the two vertices. This +is still retrieved using the path_length() method. The path vertices +will not be available. You should probably only use this on a DAG, +and not with C<reflexive>. + =back =back diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/lib/Graph/Traversal.pm new/Graph-0.9709/lib/Graph/Traversal.pm --- old/Graph-0.9708/lib/Graph/Traversal.pm 2020-10-31 22:35:41.000000000 +0100 +++ new/Graph-0.9709/lib/Graph/Traversal.pm 2020-11-21 16:07:36.000000000 +0100 @@ -578,7 +578,7 @@ of how they are determined: if they have been explicitly defined, use that value. If not, use the value of C<next_alphabetic>, if that has been defined. If not, use the value of C<next_numeric>, if that has -been defined. If not, the next vertex to be visited is chose randomly. +been defined. If not, the next vertex to be visited is chosen randomly. =head2 Methods diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/lib/Graph.pm new/Graph-0.9709/lib/Graph.pm --- old/Graph-0.9708/lib/Graph.pm 2020-11-06 22:53:05.000000000 +0100 +++ new/Graph-0.9709/lib/Graph.pm 2020-11-22 20:16:42.000000000 +0100 @@ -13,7 +13,7 @@ use Graph::AdjacencyMap qw(:flags :fields); -our $VERSION = '0.9708'; +our $VERSION = '0.9709'; require 5.006; # Weak references are absolutely required. @@ -1373,7 +1373,7 @@ sub get_vertex_attributes { my $g = shift; $g->expect_non_multivertexed; - return unless $g->has_vertex( @_ ); + return undef unless $g->has_vertex( @_ ); my $a = $g->[ _V ]->_get_path_attrs( @_ ); ($g->is_compat02) ? (defined $a ? %{ $a } : ()) : $a; } @@ -1552,7 +1552,7 @@ sub get_edge_attributes { my $g = shift; $g->expect_non_multiedged; - return unless $g->has_edge( @_ ); + return undef unless $g->has_edge( @_ ); my $a = $g->[ _E ]->_get_path_attrs( $g->_vertex_ids( @_ ) ); ($g->is_compat02) ? (defined $a ? %{ $a } : ()) : $a; } @@ -1734,6 +1734,24 @@ return $g; } +sub as_hashes { + my ($g) = @_; + my %e; + $e{ $_->[0] }{ $_->[1] } = $g->get_edge_attributes(@$_) || {} for $g->edges; + my %n = map +( $_ => $g->get_vertex_attributes($_) || {} ), $g->vertices; + ( \%n, \%e ); +} + +sub ingest { + my ($g, $g2) = @_; + for my $v ($g2->vertices) { + $g->set_vertex_attributes($v, $g2->get_vertex_attributes($v)); + $g->set_edge_attributes(@$_, $g2->get_edge_attributes(@$_)) + for $g2->edges_from($v); + } + $g; +} + ### # More constructors. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/lib/Graph.pod new/Graph-0.9709/lib/Graph.pod --- old/Graph-0.9708/lib/Graph.pod 2020-11-06 22:40:50.000000000 +0100 +++ new/Graph-0.9709/lib/Graph.pod 2020-11-22 20:11:58.000000000 +0100 @@ -113,7 +113,7 @@ L</connected_components>, L</connected_component_by_vertex>, L</connected_component_by_index>, and L</same_connected_components>). If C<unionfind> is used, adding edges (and vertices) becomes slower, -but connectedness queries become faster. You B<must not> delete egdes or +but connectedness queries become faster. You B<must not> delete edges or vertices of an unionfind graph, only add them. You can test a graph for "union-findness" with @@ -620,6 +620,13 @@ Returns the graph. +=item ingest + + $g->ingest($g2) + +Ingests all the vertices and edges of the given graph, including +attributes. Returns the ingesting graph. + =back =head2 Accessors @@ -1266,6 +1273,14 @@ In scalar context return the number of self-loop vertices. See L</is_self_loop_vertex> for the definition of a self-loop vertex. +=item as_hashes + + ($nodes, $edges) = $g->as_hashes + +Return hash-refs which map vertices to their attributes, and for edges, +a two-level hash mapping the predecessor to its successors, mapped to +the attributes. + =back =head2 Connected Graphs and Their Components @@ -1747,7 +1762,7 @@ Return as a graph the single-source shortest paths of the graph using Bellman-Ford's algorithm. The graph can contain negative edges but not negative cycles (negative cycles cause the algorithm to abort -with an error message C<Graph::SPT_Bellman_Ford: negative cycle exists/>). +with an error message C<Graph::SPT_Bellman_Ford: negative cycle exists>). You can choose the start vertex of the result with either a single vertex argument or with $opt{ first_root }, otherwise a random vertex @@ -1772,7 +1787,7 @@ vertex can have several successors. You can first find the C<neighbors()> vertices and then remove the predecessor vertex.) -If you want to find the shortes path between two vertices, +If you want to find the shortest path between two vertices, see L</SP_Bellman_Ford>. =item SSSP_Bellman_Ford @@ -2181,7 +2196,8 @@ $attr = $g->get_vertex_attributes($v) -Return all the attributes of the vertex as an anonymous hash. +Return all the attributes of the vertex as an anonymous hash, or C<undef> +if no such vertex. =item get_vertex_attribute_names @@ -2293,7 +2309,8 @@ $attr = $g->get_edge_attributes($u, $v) -Return all the attributes of the edge as an anonymous hash. +Return all the attributes of the edge as an anonymous hash, or C<undef> +if no such edge. =item get_edge_attribute_names diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/t/50_vertex_attributes.t new/Graph-0.9709/t/50_vertex_attributes.t --- old/Graph-0.9708/t/50_vertex_attributes.t 2020-10-20 05:06:19.000000000 +0200 +++ new/Graph-0.9709/t/50_vertex_attributes.t 2020-11-21 19:52:21.000000000 +0100 @@ -1,5 +1,5 @@ use strict; use warnings; -use Test::More tests => 85; +use Test::More tests => 86; use Graph; my $g = Graph->new; @@ -108,6 +108,7 @@ ok($g->set_vertex_attributes('a', { 'color' => 'pearl', 'weight' => 'heavy' })); $attr = $g->get_vertex_attributes('a'); +is_deeply [ $g->get_vertex_attributes('z') ], [ undef ]; is(scalar keys %$attr, 2); is($attr->{color}, 'pearl'); is($attr->{weight}, 'heavy'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/t/52_edge_attributes.t new/Graph-0.9709/t/52_edge_attributes.t --- old/Graph-0.9708/t/52_edge_attributes.t 2020-10-20 05:06:19.000000000 +0200 +++ new/Graph-0.9709/t/52_edge_attributes.t 2020-11-21 19:56:06.000000000 +0100 @@ -1,5 +1,5 @@ use strict; use warnings; -use Test::More tests => 101; +use Test::More tests => 102; use Graph; my $g = Graph->new; @@ -38,6 +38,7 @@ is( scalar keys %$attr, 1 ); is( scalar @name, 1 ); is( scalar @val, 1 ); +is_deeply [ $g->get_edge_attributes("a", "z") ], [ undef ]; is( $attr->{color}, "green" ); is( $name[0], "color" ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/t/72_transitive.t new/Graph-0.9709/t/72_transitive.t --- old/Graph-0.9708/t/72_transitive.t 2020-10-20 05:06:19.000000000 +0200 +++ new/Graph-0.9709/t/72_transitive.t 2020-11-21 00:04:12.000000000 +0100 @@ -1,5 +1,5 @@ use strict; use warnings; -use Test::More tests => 231; +use Test::More tests => 243; use Graph::Directed; use Graph::Undirected; @@ -423,3 +423,31 @@ is $apsp->path_length($u, $v), $length, "length $u $v"; } } + +{ + my @example = ( [ 1, 2 ], + [ 1, 3 ], + [ 1, 4 ], # direct link to two away + [ 3, 4 ] ); + my $g = Graph::Directed->new; + $g->add_edge(@$_) for @example; + my $path_counts = $g->APSP_Floyd_Warshall(path_count => 1); + my @counts = ( + [ 1, 2, 1 ], + [ 1, 3, 1 ], + [ 1, 4, 2 ], + [ 2, 1, 0 ], + [ 2, 3, 0 ], + [ 2, 4, 0 ], + [ 3, 1, 0 ], + [ 3, 2, 0 ], + [ 3, 4, 1 ], + [ 4, 1, 0 ], + [ 4, 2, 0 ], + [ 4, 3, 0 ], + ); + foreach my $e (@counts) { + my ($u, $v, $count) = @$e; + is $path_counts->path_length($u, $v), $count, "count $u $v"; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9708/t/99_misc.t new/Graph-0.9709/t/99_misc.t --- old/Graph-0.9708/t/99_misc.t 2020-11-06 22:46:16.000000000 +0100 +++ new/Graph-0.9709/t/99_misc.t 2020-11-22 20:15:12.000000000 +0100 @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 34; +use Test::More tests => 36; use Graph::Directed; use Graph::Undirected; @@ -11,6 +11,15 @@ $g0->add_edge(@$_) for @E; +is_deeply [ $g0->as_hashes ], [ + { map +($_ => {}), qw(a b c d e f g) }, + { + a => { map +($_ => {}), qw(b c) }, + b => { map +($_ => {}), qw(d e) }, + c => { map +($_ => {}), qw(f g) }, + }, +]; + my $da0 = $g0->subgraph_by_radius('a', 0); my $da1 = $g0->subgraph_by_radius('a', 1); my $da2 = $g0->subgraph_by_radius('a', 2); @@ -32,6 +41,18 @@ is($db3, "b-d,b-e"); { + my $gi0 = Graph->new; + $gi0->set_edge_attribute(qw(a b), weight => 1); + my $gi1 = Graph->new; + $gi1->set_vertex_attribute('x', shape => 1); + $gi1->set_edge_attribute(qw(x y), weight => 2); + is_deeply [ $gi0->ingest($gi1)->as_hashes ], [ + { x => { shape => 1 }, map +($_ => {}), qw(a b y) }, + { a => { b => { weight => 1 } }, x => { y => { weight => 2 } } }, + ]; +} + +{ my $gh = Graph->new(hypervertexed => 1); $gh->add_vertex(@$_) for ( ['a'], [qw(a c)], [qw(a b c)], [qw(a c e)], [qw(a c d)], [], _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org