diff -Nru libgraph-moreutils-perl-0.1.0/Changes libgraph-moreutils-perl-0.2.0/Changes --- libgraph-moreutils-perl-0.1.0/Changes 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/Changes 2023-12-08 14:13:46.000000000 +0000 @@ -1,3 +1,7 @@ +0.2.0 2023-12-08 + + - Implementing graph_replace(). + 0.1.0 2023-10-17 - Initial release. diff -Nru libgraph-moreutils-perl-0.1.0/MANIFEST libgraph-moreutils-perl-0.2.0/MANIFEST --- libgraph-moreutils-perl-0.1.0/MANIFEST 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/MANIFEST 2023-12-08 14:13:46.000000000 +0000 @@ -10,6 +10,7 @@ lib/Graph/MoreUtils.pm lib/Graph/MoreUtils/Line.pm lib/Graph/MoreUtils/Line/SelfLoopVertex.pm +lib/Graph/MoreUtils/Replace.pm lib/Graph/MoreUtils/SSSR.pm lib/Graph/MoreUtils/Smooth.pm lib/Graph/MoreUtils/Smooth/Intermediate.pm diff -Nru libgraph-moreutils-perl-0.1.0/META.json libgraph-moreutils-perl-0.2.0/META.json --- libgraph-moreutils-perl-0.1.0/META.json 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/META.json 2023-12-08 14:13:46.000000000 +0000 @@ -22,7 +22,8 @@ "runtime" : { "requires" : { "Graph" : "0", - "Scalar::Util" : "0" + "Scalar::Util" : "0", + "Set::Object" : "0" } }, "test" : { @@ -43,7 +44,7 @@ "web" : "https://github.com/merkys/graph-moreutils" } }, - "version" : "0.1.0", + "version" : "0.2.0", "x_generated_by_perl" : "v5.30.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.19" } diff -Nru libgraph-moreutils-perl-0.1.0/META.yml libgraph-moreutils-perl-0.2.0/META.yml --- libgraph-moreutils-perl-0.1.0/META.yml 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/META.yml 2023-12-08 14:13:46.000000000 +0000 @@ -16,10 +16,11 @@ requires: Graph: '0' Scalar::Util: '0' + Set::Object: '0' resources: bugtracker: https://github.com/merkys/graph-moreutils/issues homepage: https://search.cpan.org/dist/Graph-MoreUtils repository: git://github.com/merkys/graph-moreutils.git -version: 0.1.0 +version: 0.2.0 x_generated_by_perl: v5.30.0 x_serialization_backend: 'YAML::Tiny version 1.73' diff -Nru libgraph-moreutils-perl-0.1.0/Makefile.PL libgraph-moreutils-perl-0.2.0/Makefile.PL --- libgraph-moreutils-perl-0.1.0/Makefile.PL 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/Makefile.PL 2023-12-08 14:13:46.000000000 +0000 @@ -17,12 +17,13 @@ "NAME" => "Graph::MoreUtils", "PREREQ_PM" => { "Graph" => 0, - "Scalar::Util" => 0 + "Scalar::Util" => 0, + "Set::Object" => 0 }, "TEST_REQUIRES" => { "Test::More" => 0 }, - "VERSION" => "0.1.0", + "VERSION" => "0.2.0", "test" => { "TESTS" => "t/*.t t/SSSR/*.t t/line/*.t t/smoothed/*.t" } @@ -32,6 +33,7 @@ my %FallbackPrereqs = ( "Graph" => 0, "Scalar::Util" => 0, + "Set::Object" => 0, "Test::More" => 0 ); diff -Nru libgraph-moreutils-perl-0.1.0/README libgraph-moreutils-perl-0.2.0/README --- libgraph-moreutils-perl-0.1.0/README 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/README 2023-12-08 14:13:46.000000000 +0000 @@ -1,5 +1,5 @@ This archive contains the distribution Graph-MoreUtils, -version 0.1.0: +version 0.2.0: Utilities for graphs diff -Nru libgraph-moreutils-perl-0.1.0/debian/changelog libgraph-moreutils-perl-0.2.0/debian/changelog --- libgraph-moreutils-perl-0.1.0/debian/changelog 2023-10-27 08:59:52.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/debian/changelog 2023-12-11 14:57:20.000000000 +0000 @@ -1,3 +1,9 @@ +libgraph-moreutils-perl (0.2.0-1) unstable; urgency=medium + + * New upstream version 0.2.0 + + -- Andrius Merkys Mon, 11 Dec 2023 09:57:20 -0500 + libgraph-moreutils-perl (0.1.0-2) unstable; urgency=low * No-changes source-only upload. diff -Nru libgraph-moreutils-perl-0.1.0/dist.ini libgraph-moreutils-perl-0.2.0/dist.ini --- libgraph-moreutils-perl-0.1.0/dist.ini 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/dist.ini 2023-12-08 14:13:46.000000000 +0000 @@ -3,7 +3,7 @@ license = LGPL_3_0 copyright_holder = Andrius Merkys copyright_year = 2020-2023 -version = 0.1.0 +version = 0.2.0 [@Filter] -bundle = @Basic @@ -19,6 +19,7 @@ [Prereqs] Graph = 0 Scalar::Util = 0 +Set::Object = 0 [Prereqs / Test] -phase = test diff -Nru libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Line/SelfLoopVertex.pm libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Line/SelfLoopVertex.pm --- libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Line/SelfLoopVertex.pm 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Line/SelfLoopVertex.pm 2023-12-08 14:13:46.000000000 +0000 @@ -4,7 +4,7 @@ use warnings; # ABSTRACT: Marker for artificial self-loops -our $VERSION = '0.1.0'; # VERSION +our $VERSION = '0.2.0'; # VERSION sub new { diff -Nru libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Line.pm libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Line.pm --- libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Line.pm 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Line.pm 2023-12-08 14:13:46.000000000 +0000 @@ -1,7 +1,7 @@ package Graph::MoreUtils::Line; # ABSTRACT: Generate line graphs -our $VERSION = '0.1.0'; # VERSION +our $VERSION = '0.2.0'; # VERSION use strict; use warnings; diff -Nru libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Replace.pm libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Replace.pm --- libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Replace.pm 1970-01-01 00:00:00.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Replace.pm 2023-12-08 14:13:46.000000000 +0000 @@ -0,0 +1,32 @@ +package Graph::MoreUtils::Replace; + +# ABSTRACT: Replace one on more vertices with a given one. +our $VERSION = '0.2.0'; # VERSION + +use strict; +use warnings; + +use Set::Object qw( set ); + +sub replace +{ + my( $graph, $new, @old ) = @_; + + $graph->add_vertex( $new ); + + my $old = set( @old ); + for my $edge (grep { ($old->has( $_->[0] ) && !$old->has( $_->[1] )) || + ($old->has( $_->[1] ) && !$old->has( $_->[0] )) } + $graph->edges) { + my( $vertex, $neighbour ) = $old->has( $edge->[0] ) ? @$edge : reverse @$edge; + next if $graph->has_edge( $new, $neighbour ); + $graph->add_edge( $new, $neighbour ); + next unless $graph->has_edge_attributes( @$edge ); + $graph->set_edge_attributes( $new, $neighbour, $graph->get_edge_attributes( @$edge ) ); + } + $graph->delete_vertices( @old ); + + return $graph; +} + +1; diff -Nru libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/SSSR.pm libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/SSSR.pm --- libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/SSSR.pm 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/SSSR.pm 2023-12-08 14:13:46.000000000 +0000 @@ -1,7 +1,7 @@ package Graph::MoreUtils::SSSR; # ABSTRACT: Find the Smallest Set of Smallest Rings in graph -our $VERSION = '0.1.0'; # VERSION +our $VERSION = '0.2.0'; # VERSION use strict; use warnings; diff -Nru libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Smooth/Intermediate.pm libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Smooth/Intermediate.pm --- libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Smooth/Intermediate.pm 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Smooth/Intermediate.pm 2023-12-08 14:13:46.000000000 +0000 @@ -1,7 +1,7 @@ package Graph::MoreUtils::Smooth::Intermediate; # ABSTRACT: Container for intermediate vertices -our $VERSION = '0.1.0'; # VERSION +our $VERSION = '0.2.0'; # VERSION use strict; use warnings; diff -Nru libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Smooth.pm libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Smooth.pm --- libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils/Smooth.pm 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils/Smooth.pm 2023-12-08 14:13:46.000000000 +0000 @@ -1,7 +1,7 @@ package Graph::MoreUtils::Smooth; # ABSTRACT: Generate smoothed graphs -our $VERSION = '0.1.0'; # VERSION +our $VERSION = '0.2.0'; # VERSION use strict; use warnings; diff -Nru libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils.pm libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils.pm --- libgraph-moreutils-perl-0.1.0/lib/Graph/MoreUtils.pm 2023-10-17 14:48:22.000000000 +0000 +++ libgraph-moreutils-perl-0.2.0/lib/Graph/MoreUtils.pm 2023-12-08 14:13:46.000000000 +0000 @@ -1,7 +1,7 @@ package Graph::MoreUtils; # ABSTRACT: Utilities for graphs -our $VERSION = '0.1.0'; # VERSION +our $VERSION = '0.2.0'; # VERSION =head1 NAME @@ -9,7 +9,7 @@ =head1 SYNOPSIS - use Graph::MoreUtils qw( SSSR line smooth ); + use Graph::MoreUtils qw( line ); use Graph::Undirected; my $G = Graph::Undirected->new; @@ -27,11 +27,13 @@ use parent Exporter::; use Graph::MoreUtils::Line; +use Graph::MoreUtils::Replace; use Graph::MoreUtils::SSSR; use Graph::MoreUtils::Smooth; our @EXPORT_OK = qw( SSSR + graph_replace line smooth ); @@ -51,6 +53,15 @@ sub SSSR { &Graph::MoreUtils::SSSR::SSSR } +=head2 C + +Replaces one or more vertices (C<@old>) in the graph with a given one (C<$new>). +All edges between the replaced vertices are removed and all edges with other vertices become a reconnected to the new one. + +=cut + +sub graph_replace { &Graph::MoreUtils::Replace::replace } + =head2 C Generates line graphs for L objects.