Result:
found more than 672 distributions - search limited to the first 2001 files matching your query ( run in 1.497 )


Geo-Ellipsoid

 view release on metacpan or  search on metacpan

gentest/gentest_ellipsoid.pl  view on Meta::CPAN

my( $r1,$r2,$r3,$r4,$r5);
EOS
  $tests{range}{code} = [ $code ];
  ${$tests{range}}{count} = 0;

  # test endpoints: poles and equator
  for( my $lat1 = $lat0; $lat1 <= 90; $lat1 += $latinc ) {
    for( my $lon1 = $lon0; $lon1 <= 270; $lon1 += $loninc ) {
      next if abs($lat1) == 90 and $lon1 > 0;
      print "  loc1 = ($lat1,$lon1)\n" if $debug;
      for( my $lat2 = $lat0; $lat2 <= 90; $lat2 += $latinc ) {

 view all matches for this distribution


Geo-Geos

 view release on metacpan or  search on metacpan

src/mapbox/earcut.hpp  view on Meta::CPAN

    double hy = hole->y;
    double qx = -std::numeric_limits<double>::infinity();
    Node* m = nullptr;

    // find a segment intersected by a ray from the hole's leftmost Vertex to the left;
    // segment's endpoint with lesser x will be potential connection Vertex
    do {
        if (hy <= p->y && hy >= p->next->y && p->next->y != p->y) {
          double x = p->x + (hy - p->y) * (p->next->x - p->x) / (p->next->y - p->y);
          if (x <= hx && x > qx) {
            qx = x;

src/mapbox/earcut.hpp  view on Meta::CPAN


    if (!m) return 0;

    if (hx == qx) return m->prev;

    // look for points inside the triangle of hole Vertex, segment intersection and endpoint;
    // if there are no points found, we have a valid connection;
    // otherwise choose the Vertex of the minimum angle with the ray as connection Vertex

    const Node* stop = m;
    double tanMin = std::numeric_limits<double>::infinity();

 view all matches for this distribution


Geo-Google-PolylineEncoder

 view release on metacpan or  search on metacpan

lib/Geo/Google/PolylineEncoder.pm  view on Meta::CPAN

package Geo::Google::PolylineEncoder;

use strict;
use warnings;

use accessors qw(num_levels zoom_factor visible_threshold force_endpoints
		 zoom_level_breaks escape_encoded_points lons_first
		 points dists max_dist encoded_points encoded_levels );
use constant defaults => {
			  num_levels  => 18,
			  zoom_factor => 2,
			  force_endpoints => 1,
			  escape_encoded_points => 0,
			  visible_threshold => 0.00001,
			  lons_first => 0,
			 };
our $VERSION = 0.06;

lib/Geo/Google/PolylineEncoder.pm  view on Meta::CPAN

    my $visible_threshold = $self->visible_threshold;
    my $zoom_level_breaks = $self->zoom_level_breaks;

    my $encoded_levels = "";

    if ($self->force_endpoints) {
	$encoded_levels .= $self->encode_number($num_levels_minus_1);
    } else {
	$encoded_levels .= $self->encode_number($num_levels_minus_1 - $self->compute_level($max_dist));
    }

lib/Geo/Google/PolylineEncoder.pm  view on Meta::CPAN


	    $encoded_levels .= $self->encode_number($num_levels_minus_1 - $level);
	}
    }

    if ($self->force_endpoints) {
	$encoded_levels .= $self->encode_number($num_levels_minus_1);
    } else {
	$encoded_levels .= $self->encode_number($num_levels_minus_1 - $self->compute_level($max_dist));
    }

lib/Geo/Google/PolylineEncoder.pm  view on Meta::CPAN


=item new( [%args] )

Create a new encoder.  Arguments are optional and correspond to the accessor
with the same name: L</num_levels>, L</zoom_factor>, L</visible_threshold>,
L</force_endpoints>, etc...

Note: there's nothing stopping you from setting these properties each time you
L</encode> a polyline.

=item num_levels

lib/Geo/Google/PolylineEncoder.pm  view on Meta::CPAN

=item visible_threshold

Indicates the length of a barely visible object at the highest zoom level.
Default: 0.00001.  err.. units.

=item force_endpoints

Indicates whether or not the endpoints should be visible at all zoom levels.
force_endpoints is.  Probably should stay true regardless.
Default: 1=true.

=item escape_encoded_points

Indicates whether or not the encoded points should have escape characters

 view all matches for this distribution


Geo-TCX

 view release on metacpan or  search on metacpan

lib/Geo/TCX.pm  view on Meta::CPAN

    if ( $o->{tag_course} ) {
        # in Courses, data is structured as <Lap>...</Lap><Lap>...</Lap><Track>...</Track><Track>...</Track>
        # actually, not sure just seem like it's one long ... track, not multiple ones, which complicates things
        my $xml_str = $o->{tag_course};

        my (@lap_tags, @lap_endpoints, @track_tags);

        if ( $xml_str =~ m,(<Lap>.*</Lap>),s ) {
            my $str = $1;
            @lap_tags = split(/(?s)<\/Lap>\s*<Lap>/, $str );
            if (@lap_tags == 0) { push @lap_tags, $str }

lib/Geo/TCX.pm  view on Meta::CPAN


        for my $i (0 .. $#lap_tags) {
            my ($end_pos, $end_pt);
            if ( $lap_tags[$i] =~ m,<EndPosition>(.*)</EndPosition>,s ) {
                $end_pt = Geo::TCX::Trackpoint->new( $1 );
                push @lap_endpoints, $end_pt
            }
            # since split removed tags sometimes at ^ of string for other at $
            # let's remove them all and add back
            $lap_tags[$i] =~ s,</?Lap>,,g;
            $lap_tags[$i] =~ s,^,<Lap>,g;

lib/Geo/TCX.pm  view on Meta::CPAN

        if (@lap_tags ==1)  { $track_tags[0] = $track_str }
        else  {
            my ($t1, $t2);
            for my $i (0 .. $#lap_tags ) {
                if ($i < $#lap_tags) {
                    ($t1, $t2) = $t->split_at_point_closest_to( $lap_endpoints[$i] );
                    push @track_tags, $t1->xml_string;
                    $t = $t2
                } else { push @track_tags, $t->xml_string } # ie don't split the last track portion
            }
        }

 view all matches for this distribution


Geo-What3Words

 view release on metacpan or  search on metacpan

lib/Geo/What3Words.pm  view on Meta::CPAN


sub new {
    my ($class, %params) = @_;

    my $self = {};
    $self->{api_endpoint} = $params{api_endpoint} || 'https://api.what3words.com/v3/';
    $self->{key}          = $params{key}          || die "API key not set";
    $self->{language}     = $params{language};
    $self->{logging}      = $params{logging};

    ## _ua is used for testing. But could also be used to

lib/Geo/What3Words.pm  view on Meta::CPAN

sub ping {
    my $self = shift;

    ## http://example.com/some/path => example.com
    ## also works with IP addresses
    my $host = URI->new($self->{api_endpoint})->host;

    $self->_log("pinging $host...");

    my $netping = Net::Ping->new('external');
    my $res     = $netping->ping($host);

lib/Geo/What3Words.pm  view on Meta::CPAN


    foreach my $key (keys %$rh_fields) {
        delete $rh_fields->{$key} if (!defined($rh_fields->{$key}));
    }

    my $uri = URI->new($self->{api_endpoint} . $method_name);
    $uri->query_form($rh_fields);
    my $url = $uri->as_string;

    $self->_log("GET $url");
    my $response = $self->{ua}->get($url);

lib/Geo/What3Words.pm  view on Meta::CPAN

=item language

Default language for 3 word addresses (e.g. C<'ru'>, C<'de'>). Can be
overridden per request.

=item api_endpoint

Override the API URL. Defaults to C<https://api.what3words.com/v3/>.

=item ua

 view all matches for this distribution


GeoIP2

 view release on metacpan or  search on metacpan

lib/GeoIP2/Record/Traits.pm  view on Meta::CPAN

This returns the autonomous system number
(L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) associated with
the IP address.

This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.

=head2 $traits_rec->autonomous_system_organization()

This returns the organization associated with the registered autonomous system
number (L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) for the IP
address.

This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.

=head2 $traits_rec->connection_type()

This returns the connection type associated with the IP address. It may take
the following values: C<Dialup>, C<Cable/DSL>, C<Corporate>, or C<Cellular>.

lib/GeoIP2/Record/Traits.pm  view on Meta::CPAN


This returns the second level domain associated with the IP address. This will
be something like "example.com" or "example.co.uk", not "foo.example.com".

This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.

=head2 $traits_rec->ip_address()

This returns the IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the externally

lib/GeoIP2/Record/Traits.pm  view on Meta::CPAN

=head2 $traits_rec->isp()

This returns the name of the ISP associated with the IP address.

This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.

=head2 $traits_rec->organization()

This returns the name of the organization associated with the IP address.

This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.

=head2 $traits_rec->user_type()

This returns the user type associated with the IP address. This can be one of
the following values:

 view all matches for this distribution


Gerrit-REST

 view release on metacpan or  search on metacpan

lib/Gerrit/REST.pm  view on Meta::CPAN


=back

=head1 METHODS

Gerrit's REST API documentation lists dozens of "endpoints" which can
be operated via the standard HTTP requests: GET, DELETE, PUT, and
POST. Gerrit::REST objects implement four methods called GET, DELETE,
PUT, and POST to make it easier to invoke and get results from
Gerrit's REST endpoints.

All four methods need a RESOURCE argument which is simply a string
denoting the endpoint URL's path, as indicated in the documentation.

PUT and POST second argument (usually a hash-ref, but sometimes a simple
string) is encoded using the C<encode> method of a C<JSON> object and passed
as contents of the underlying associated HTTP method.

All four methods return the value returned by the associated
endpoint's method, as specified in the documentation, decoded
according to its content type as follows:

=over

=item * application/json

The majority of the API's endpoints return JSON values. Those are
decoded using the C<decode> method of a C<JSON> object. Most of the
endpoints return hashes, which are returned as a Perl hash-ref.

=item * text/plain

Those values are returned as simple strings.

=back

Some endpoints don't return anything. In those cases, the methods
return C<undef>. The methods croak if they get any other type of
values in return.

In case of errors (i.e., if the underlying HTTP method return an error code
different from 2xx) the methods croak with a string error message.

 view all matches for this distribution


Gimp

 view release on metacpan or  search on metacpan

examples/burst  view on Meta::CPAN

	  my $m = sin($angle)/cos($angle);
	  if ($m ==0) { $m = 0.000000000001; } #avoid div by 0
	  if ($c ==0) { $c = 0.000000000001; } #avoid div by 0
	  if ($d ==0) { $d = 0.000000000001; } #avoid div by 0

	  # find the positive solution of the quadratic for the endpoints
	  my $x = sqrt(1/((1/$a/$a)+($m*$m/$b/$b)));
	  my $y = sqrt(1/((1/($m*$m*$a*$a))+(1/$b/$b)));

	  # and find the starting points in the same manner
	  my $x_start = sqrt(1/((1/$c/$c)+($m*$m/$d/$d)));

 view all matches for this distribution


Git-Hooks

 view release on metacpan or  search on metacpan

t/02-check-jira.t  view on Meta::CPAN

                  fixVersions => [{name => 'master'}],
               }},
);

sub GET {
    my ($jira, $endpoint) = @_;
    my $key;
    if ($endpoint =~ m:/issue/(.*):) {
        $key = $1;
    } else {
        die "JIRA::Client(fake): no such endpoint ($endpoint)\n";
    }
    if (exists $issues{$key}) {
        return $issues{$key};
    } else {
        die "JIRA::Client(fake): no such issue ($key)\n";

 view all matches for this distribution


Git-Raw

 view release on metacpan or  search on metacpan

lib/Git/Raw/Walker.pm  view on Meta::CPAN

Push HEAD of the repository to the list of commits to be used as roots when
starting a revision walk.

=head2 push_range( $start, $end )

Push and hide the respective endpoints of the given range. C<$start> and C<$end>
should be C<"commitish">, that is, it should be a L<Git::Raw::Commit> or
L<Git::Raw::Reference> object, or alternatively a commit id or commit id prefix.

=head2 push_range( $range )

Push and hide the respective endpoints of the given range. C<$range> should be
of the form C<"start_commit_id..end_commit_id">.

=head2 hide( $commit )

Hide a L<Git::Raw::Commit> and its ancestors from the walker.

 view all matches for this distribution


GitLab-API-v3

 view release on metacpan or  search on metacpan

author/generate.pl  view on Meta::CPAN

foreach my $section_pack (@{ $config->{sections} }) {
foreach my $section_name (keys %$section_pack) {
    my $section = $section_pack->{$section_name};

    my $file = $dir->child("$section_name.yml");
    my $endpoints = YAML::XS::Load( $file->slurp() );

    print "=head1 $section->{head}\n\n";
    print "See L<$section->{doc_url}>.\n\n";

    foreach my $endpoint_pack (@$endpoints) {
    foreach my $sub (keys %$endpoint_pack) {
        my $spec = $endpoint_pack->{$sub};

        my ($return, $method, $path, $params_ok);
        if ($spec =~ m{^(?:(\S+) = |)(GET|POST|PUT|DELETE) (\S+?)(\??)$}) {
            ($return, $method, $path, $params_ok) = ($1, $2, $3, $4);
        }

 view all matches for this distribution


GitLab-API-v4

 view release on metacpan or  search on metacpan

author/generate.pl  view on Meta::CPAN

foreach my $section_pack (@{ $config->{sections} }) {
foreach my $section_name (keys %$section_pack) {
    my $section = $section_pack->{$section_name};

    my $file = $dir->child("$section_name.yml");
    my $endpoints = YAML::XS::Load( $file->slurp() );

    print "=head2 $section->{head}\n\n";
    print "See L<$section->{doc_url}>.\n\n";
    print "=over\n\n";

    foreach my $endpoint (@$endpoints) {
        if (keys(%$endpoint) == 1) {
            my ($method) = keys %$endpoint;
            $endpoint = {
                method => $method,
                spec   => $endpoint->{$method},
            };
        }

        my $method = $endpoint->{method};
        my $spec = $endpoint->{spec};

        my ($return, $verb, $path, $params_ok);
        if ($spec =~ m{^(?:(\S+) = |)(GET|POST|PUT|DELETE) ([^/\s]\S*?[^/\s]?)(\??)$}) {
            ($return, $verb, $path, $params_ok) = ($1, $2, $3, $4);
        }

author/generate.pl  view on Meta::CPAN

            die "Invalid spec ($method): $spec";
        }

        my $no_decode = 0;
        $no_decode = 1 if !$return;
        $no_decode = 1 if $endpoint->{no_decode};

        print "=item $method\n\n";
        print '    ';

        print "my \$$return = " if $return;

author/generate.pl  view on Meta::CPAN

        print ");\n\n";

        print "Sends a C<$verb> request to C<$path>";
        print ' and returns the ' . ($no_decode ? 'raw' : 'decoded') . ' response content' if $return;
        print ".\n\n";
        print "$endpoint->{note}\n" if $endpoint->{note};
        print "=cut\n\n";

        print "sub $method {\n";
        print "    my \$self = shift;\n";

 view all matches for this distribution


Google-Ads-AdWords-Client

 view release on metacpan or  search on metacpan

lib/Google/Ads/AdWords/Client.pm  view on Meta::CPAN

      if ($@) {
        warn("Module $module_name was not found.");
        return;
      } else {

        # Generating the service endpoint url of the form
        # https://{server_url}/{group_name(cm/job/info/o)}/{version}/{service}.
        my $server_url =
          $self->get_alternate_url() =~ /\/$/
          ? substr($self->get_alternate_url(), 0, -1)
          : $self->get_alternate_url();
        my $service_to_group_name =
          $Google::Ads::AdWords::Constants::SERVICE_TO_GROUP{$method_name};
        if (!$service_to_group_name) {
          die("Service " . $method_name . " is not configured in the library.");
        }
        my $endpoint_url =
          sprintf(Google::Ads::AdWords::Constants::PROXY_FORMAT_STRING,
          $server_url, $service_to_group_name, $self->get_version(),
          $method_name);

        # If a suitable module is found, instantiate it and store it in
        # instance-specific storage to emulate a singleton.
        my $service_port = $module_name->new({

            # Setting the server endpoint of the service.
            proxy => [$endpoint_url],

            # Associating our custom serializer.
            serializer =>
              Google::Ads::AdWords::Serializer->new({client => $self}),

 view all matches for this distribution


Google-Ads-GoogleAds-Client

 view release on metacpan or  search on metacpan

lib/Google/Ads/GoogleAds/Constants.pm  view on Meta::CPAN

use constant DEFAULT_API_VERSION => "V24";

# The Google OAuth2 service base URL.
use constant OAUTH2_BASE_URL => "https://accounts.google.com/o/oauth2";

# The Google OAuth2 tokeninfo endpoint.
use constant OAUTH2_TOKEN_INFO_URL => "https://oauth2.googleapis.com/tokeninfo";

# Default OAuth2 scope for Google Ads API.
use constant DEFAULT_OAUTH2_SCOPE => "https://www.googleapis.com/auth/adwords";

 view all matches for this distribution


Google-ContentAPI

 view release on metacpan or  search on metacpan

lib/Google/ContentAPI.pm  view on Meta::CPAN

#
# Bill Gerrard <bill@gerrard.org>
#
# VERSION HISTORY
#
# + v1.03       12/10/2020 Allow custom endpoint, update docs for v2.1 API
# + v1.02       04/11/2018 Add accountstatuses, productstatuses methods. Add "custom" resource
# + v1.01       03/27/2018 Added config_json, merchant_id options and switched to Crypt::JWT
# + v1.00       03/23/2018 initial release
#
# COPYRIGHT AND LICENSE

lib/Google/ContentAPI.pm  view on Meta::CPAN

    }
    $self->{merchant_id} = $self->{config}->{merchant_id}
        || $params->{merchant_id}
        || croak "'merchant_id' not provided in json config in new()";

    $self->{endpoint} = $self->{config}->{endpoint}
        || $params->{endpoint}
        || 'https://www.googleapis.com/content/v2';

    $self->{debug} = 1 if $params->{debug};
    $self->{google_auth_token} = get_google_auth_token($self);
    $self->{rest} = init_rest_client($self);

lib/Google/ContentAPI.pm  view on Meta::CPAN

}

sub init_rest_client {
    my $self = shift;
    my $r = REST::Client->new();
    $r->setHost($self->{endpoint});
    $r->addHeader('Authorization', $self->{google_auth_token});
    $r->addHeader('Content-type', 'application/json');
    $r->addHeader('charset', 'UTF-8');
    return $r;
}

lib/Google/ContentAPI.pm  view on Meta::CPAN


For convenience, add your Merchant account ID to the *.json file provided by Google.
Your complete *.json file, after adding your merchant ID, will look something like this:

  {
    "endpoint": "https://www.googleapis.com/content/v2.1",
    "merchant_id": "123456789",
    "type": "service_account",
    "project_id": "content-api-194321",
    "private_key_id": "11b8e20c2540c788e98b49e623ae8167dc3e4a6f",
    "private_key": "-----BEGIN PRIVATE KEY-----

lib/Google/ContentAPI.pm  view on Meta::CPAN


  use Google::ContentAPI;
  use Data::Dumper;

  my $google = Google::ContentAPI->new({
      endpoint => 'https://www.googleapis.com/content/v2.1',
      debug => 0,
      config_file => 'content-api-key.json',
      config_json => $json_text,
      merchant_id => '123456789',
  });

lib/Google/ContentAPI.pm  view on Meta::CPAN


=head2 new()

Create a new Google::ContentAPI object

=head3 endpoint

API endpoint to use.
v2.1 endpoint is 'https://www.googleapis.com/content/v2.1'.
v2.0 endpoint is 'https://www.googleapis.com/content/v2'.
If not provided, default to v2.0 endpoint for backwards compatibility.

=head3 debug

Displays API debug information

 view all matches for this distribution


Google-DNS

 view release on metacpan or  search on metacpan

lib/Google/DNS.pm  view on Meta::CPAN

use JSON::PP qw/decode_json/;
use Class::Accessor::Lite (
    rw => [qw/
        cd
        type
        endpoint
        ua
    /],
);

our $VERSION = '0.02';

lib/Google/DNS.pm  view on Meta::CPAN

    my %args  = @_;

    bless {
        cd       => ($args{cd} || $args{dnssec}) ? 1 : 0,
        type     => $args{type}     || '',
        endpoint => $args{endpoint} || 'https://dns.google.com/resolve',
        ua       => $args{ua}       || HTTP::Tiny->new,
    }, $class;
}

sub resolve {

lib/Google/DNS.pm  view on Meta::CPAN

    if ($self->type) {
        $query{type} = $self->type;
    }
    my $query_string = join('&', map { uri_escape($_).'='.uri_escape($query{$_}) } keys %query);

    my $res = $self->ua->get($self->endpoint.'?'. $query_string);
    croak "wrong response:$res->{status} $res->{reason}" unless $res->{success};
    my $json = $res->{content};
    return $json if $raw;
    return decode_json($json);
}

 view all matches for this distribution


Google-GeoCoder-Smart

 view release on metacpan or  search on metacpan

lib/Google/GeoCoder/Smart.pm  view on Meta::CPAN

  my $lng = $best_match->{geometry}{location}{lng};

=head1 DESCRIPTION

L<Google::GeoCoder::Smart|https://metacpan.org/pod/Google::GeoCoder::Smart> provides a lightweight wrapper around the Google Geocoding API
v3 endpoint:

  https://maps.googleapis.com/maps/api/geocode/json

It supports both structured addresses and place IDs, and returns decoded API
payloads with C<rawJSON> attached for debugging.

 view all matches for this distribution


Google-Plus

 view release on metacpan or  search on metacpan

lib/Google/Plus.pm  view on Meta::CPAN

=head2 C<ua>

  my $ua = $plus->ua;
  my $ua = $plus->ua(Mojo::UserAgent->new);

User agent object that retrieves JSON from the Google+ API endpoint.
Defaults to a L<Mojo::UserAgent> object.  This object will use
HTTP/HTTPS proxies when available (via C<HTTP_PROXY> and C<HTTPS_PROXY>
environment variables.)

=head1 METHODS

 view all matches for this distribution


Google-RestApi

 view release on metacpan or  search on metacpan

lib/Google/RestApi.pm  view on Meta::CPAN

  $self->{ua} = Furl->new(timeout => $self->{timeout});

  return bless $self, $class;
}

# this is the actual call to the google api endpoint. handles retries, error checking etc.
# this would normally be called via Drive or Sheets objects.
sub api {
  my $self = shift;

  state $check = signature(

lib/Google/RestApi.pm  view on Meta::CPAN

    return $url if $url;
  }
  return;
}

# the maximum number of attempts to call the google api endpoint before giving up.
# undef returns current value. postitive int sets and returns new value.
# 0 sets and returns default value.
sub max_attempts {
  my $self = shift;
  state $check = signature(positional => [PositiveOrZeroInt->where(sub { $_ < 10; }), { optional => 1 }]);

lib/Google/RestApi.pm  view on Meta::CPAN

API interacts with Google.

=head2 Chained API Calls

Every Google API module has an C<api()> method. Sub-resource objects
(see L<Google::RestApi::SubResource>) don't call the Google endpoint
directly; instead, each C<api()> prepends its own URI segment and
delegates to its parent's C<api()>. The calls chain upward until they
reach the top-level API module (e.g. DriveApi3), which prepends the
endpoint base URL and hands the fully-assembled URI to
C<Google::RestApi> for the actual HTTP request.

For example, deleting a reply on a comment on a file produces this chain:

 $reply->api(method => 'delete')

lib/Google/RestApi.pm  view on Meta::CPAN


The ultimate Google API call for the underlying classes. Handles timeouts and retries etc. %args consists of:

=over

=item * C<uri> <uri_string>: The Google API endpoint such as https://www.googleapis.com/drive/v3 along with any path segments added.

=item * C<method> <http_method_string>: The http method being used get|head|put|patch|post|delete.

=item * C<headers> <headers_string_array>: Array ref of http headers.

 view all matches for this distribution


Gpx-Addons-Filter

 view release on metacpan or  search on metacpan

lib/Gpx/Addons/Filter.pm  view on Meta::CPAN

            	if ($start < 915148800 or $end < 915148800) {
            	   carp("You are working on track-points dated before Jan 1, 1999 - strange. (Tip: this function accepts epoch-seconds only)")
            	}
            	
            	
            	# Comparing the timeframe with the segments start- and endpoint
				if ( ($first_point < $start) and ($last_point < $start) ) {
					##### Segment is completely outside of time-frame (before)
					next SEGMENT;
				} elsif (($first_point > $end) and ($last_point > $end)) {
					##### Segment is completely outside of time-frame (after)

 view all matches for this distribution


Grammar-Graph

 view release on metacpan or  search on metacpan

lib/Grammar/Graph.pm  view on Meta::CPAN

  my ($self, $src, $dst) = @_;
  $self->g->add_edge($dst, $_)
    for $self->g->successors($src);
}

sub _find_endpoints {
  my ($self, $id) = @_;

  my $symbols = $self->symbol_table;
  my $start = $symbols->{$id}{start_vertex};
  my $final = $symbols->{$id}{final_vertex};

lib/Grammar/Graph.pm  view on Meta::CPAN

      partner => $v1, name => $name);

    $self->set_vertex_label($v1, $p1);
    $self->set_vertex_label($v2, $p2);

    my ($start, $final) = $self->_find_endpoints($id);

    $self->_copy_predecessors($v, $v1);
    $self->_copy_successors($start, $v1);

    $self->_copy_successors($v, $v2);

lib/Grammar/Graph.pm  view on Meta::CPAN

  fa_remove_useless_epsilons($self, $self->g->vertices);
  _delete_unreachables($self);

  my $id = _find_id_by_shortname($self, $shortname);

  my ($start_vertex, $final_vertex) = _find_endpoints($self, $id);

  $self->_set_start_vertex($start_vertex);
  $self->_set_final_vertex($final_vertex);

  $self->fa_prelude_postlude($shortname);

 view all matches for this distribution


Graph-Dijkstra

 view release on metacpan or  search on metacpan

lib/Graph/Dijkstra.pm  view on Meta::CPAN

=head2 Version 0.4

	o Added input/output methods for Pajek (NET) format files
	o Lots of incompatible changes.
	o Changed references to edge attribute labels to consistently use: sourceID, targetID, and weight.  
	o In the farthestNode and shortestPath methods, changed origin and destination to originID and destinationID as the starting and endpoint node ID values.
	o Changed the node, edge, removeEdge, adjacent, and edgeExists methods to use hash references as parameters.  Get version of node method returns hash reference.
		> Thought is that using hash references as parameters will better support future addition of graph, node, and edge attributes.
	o Changed the farthestNode and shortestPath methods to input the node ID value(s) in the solution hash reference parameter as "originID" and "destinationID".
	o Changed the solution hash reference returned by the farthestNode, shortestPath methods to use sourceID, targetID, and weight as hash attributes replacing source, target, and cost
	o Added two graph level attributes: label and creator.  Attributes are input / output from / to files as supported by that format.

 view all matches for this distribution


Graph-Easy-Introspect

 view release on metacpan or  search on metacpan

lib/Graph/Easy/Introspect.pm  view on Meta::CPAN

	# or terminates one (prev cell is VER/HOR).
	#   Introducing corner: assign wp[ci]->wp[ci+1], then advance ci.
	#   Terminating corner: advance ci first, then assign wp[ci]->wp[ci+1].
	# VER/HOR cells: always assign wp[ci]->wp[ci+1], never advance ci.
	#
	# This gives contiguous, directed segments: each cell's endpoint equals
	# the next cell's start point.

	my %is_straight_type = (VER => 1, HOR => 1, CROSS => 1, HOLE => 1) ;

	my ($fp_lx, $fp_ly) = (0, 0) ;

 view all matches for this distribution


Graph-Easy-Manual

 view release on metacpan or  search on metacpan

doc/manual/a-star.html  view on Meta::CPAN

what happens if you have two nodes, each with 20 ports...
</p>

<p>
One of the strengths of the general A* algorithm is that it supports with ease
multiple start- and endpoints.
</p>

<h4>Multiple Startpoints</h4>

<p>

doc/manual/a-star.html  view on Meta::CPAN

<p>
In the example above, the algorithm would explore both equally likely paths at the
same time, choosing the one that hits (arbitrarily) one end port first.
<br>
With the tie-breaker, it will follow only one of the paths (f.i. East, then South),
until it either hits the endpoint, or finds an obstacle.
</p>

<h4>Multiple Endpoints</h4>

<p>
Multiple endpoints are easily implemented, too. Instead of stopping the algorithm
when we hit <i>the</i> endpoint, we watch for all of them simultanously.
<br>
In addition, instead of calculating the distance from the current node to the
endpoint, we calculate the distance to each endpoint, and then use the smallest
one.
</p>

<p>
Thus the algorithm will automatically gravitate towards the nearest port, but

doc/manual/a-star.html  view on Meta::CPAN


<a name="terminating"></a>
<h4>Stopping</h4>

<p>
The algorithm will stop when it reaches one of the possible endpoints. However, if
the path to the goal is blocked on all sides, it will run into trouble. The reason
is that our layout plane is essential infinitely big, and the algorithm would
spiral outwards and out of control, never finishing.
</p>

 view all matches for this distribution


Graph-Easy

 view release on metacpan or  search on metacpan

lib/Graph/Easy/Layout/Scout.pm  view on Meta::CPAN

  EDGE_START_N() => EDGE_END_N(),
  };

sub _end_points
  {
  # modify last field of path to be the correct endpoint; and the first field
  # to be the correct startpoint:
  my ($self, $edge, $coords, $dx, $dy) = @_;

  return $coords if $edge->undirected();

lib/Graph/Easy/Layout/Scout.pm  view on Meta::CPAN

    EDGE_END_N,
    EDGE_END_E,
    EDGE_END_S,
  ];

  # if the target/source node is of shape "edge", remove the endpoint
  if ( ($edge->{to}->attribute('shape')) eq 'edge')
    {
    $end_flags = [ 0,0,0,0 ];
    }
  if ( ($edge->{from}->attribute('shape')) eq 'edge')

 view all matches for this distribution


Graph-Fast

 view release on metacpan or  search on metacpan

lib/Graph/Fast.pm  view on Meta::CPAN

	delete($self->{vertices}->{$from}->{edges_out}->{$to});

	# now search it in the destination vertex' list, delete it there
	# also only delete the first matching one here (though now there
	# shouldn't be any duplicates at all because now we're matching the
	# actual edge, not just its endpoints like above.
	delete($self->{vertices}->{$to}->{edges_in}->{$from});

	# and remove it from the graph's vertex list
	@{$self->{edges}} = grep { $_ != $e } @{$self->{edges}}
}

 view all matches for this distribution


Graph-Layout-Aesthetic

 view release on metacpan or  search on metacpan

lib/Graph/Layout/Aesthetic/Force.pm  view on Meta::CPAN

Nodes repel each other with a force 1/d

=item L<Graph::Layout::Aesthetic::Force::NodeEdgeRepulsion|Graph::Layout::Aesthetic::Force::NodeEdgeRepulsion>

Nodes repel from the nearest point on the line through an edge
if that point is between the endpoints of the edge. Magnitude 1/d.

=item L<Graph::Layout::Aesthetic::Force::MinEdgeIntersect|Graph::Layout::Aesthetic::Force::MinEdgeIntersect>

Crossed edge midpoints repel each other with a constant magnitude of 1.
Only works in 2 dimensions.

 view all matches for this distribution


Graph-Maker-Other

 view release on metacpan or  search on metacpan

devel/lib/MyPlanar.pm  view on Meta::CPAN

  }

  foreach my $a ($p1,$p2) {
    foreach my $b ($p3,$p4) {
      if ($a->[0]==$b->[0] && $a->[1]==$b->[1]) {
        ### endpoint in common ...
        return [$a,$a];
      }
    }
  }

devel/lib/MyPlanar.pm  view on Meta::CPAN

  my ($p1,$p2, $p3,$p4) = @$points;

  # DistanceToSegment() is +ve on the left and -ve on the right.
  # Here want absolute value.
  # 
  # Shortest distance is always attained going to the endpoint of one
  # segment, since straight lines.

  my $ret;
  foreach (0,1) {
    foreach my $i (2,3) {

 view all matches for this distribution


Graph-Matching

 view release on metacpan or  search on metacpan

lib/Graph/Matching.pm  view on Meta::CPAN

    #
    # Vertices are numbered 0 .. ($nvertex-1).
    # Non-trivial blossoms are numbered nvertex .. (2*$nvertex-1)
    #
    # Edges are numbered 0 .. ($nedge-1).
    # Edge endpoints are numbered 0 .. (2*$nedge-1), such that endpoints
    # (2*k) and (2*k+1) both belong to the edge with index k.
    #
    # Many terms used in the comments come from the paper by Galil.
    # You will probably need the paper to make sense of this code.
    #

lib/Graph/Matching.pm  view on Meta::CPAN

        $maxweight = $wt if ($wt > $maxweight);
        $all_integer_weights = $all_integer_weights && ($wt == int($wt));
    }
    my $nvertex = $#nodelist + 1;

    # If $p is an endpoint index,
    # $endpoint[$p] is the vertex index to which endpoint $p is attached.
    my @endpoint;
    $#endpoint = 2*$nedge-1;
    for (my $k = $nedge - 1; $k >= 0; $k--) {
        $endpoint[2*$k]   = $nodemap{$graph->[$k]->[0]};
        $endpoint[2*$k+1] = $nodemap{$graph->[$k]->[1]};
    }

    # If $v is a vertex index,
    # $neighbend[$v] refers to an array of remote endpoints attached to $v.
    my @neighbend;
    $#neighbend = $nvertex-1;
    for (my $k = $nedge - 1; $k >= 0; $k--) {
        my $v = $endpoint[2*$k];
        my $w = $endpoint[2*$k+1];
        assert($v != $w);
        push @{$neighbend[$v]}, 2*$k + 1;
        push @{$neighbend[$w]}, 2*$k;
    }

    # If $v is a vertex index,
    # $mate[$v] is the remote endpoint of its matched edge, or -1 if $v
    # is single. (i.e. $endpoint[$mate[$v]] is $v's partner vertex)
    # Initially all vertices are single.
    my @mate = ( -1 ) x $nvertex;

    # If $b is a top-level blossom,
    # $label[$b] is 0 if $b is unlabeled (free);

lib/Graph/Matching.pm  view on Meta::CPAN

    # $label[$v] is 2 iff $v is reachable from an S-vertex outside the blossom.
    # Labels are assigned during a stage and reset after each augmentation.
    my @label = ( 0 ) x (2*$nvertex);

    # If $b is a labeled top-level blossom,
    # $labelend[$b] is the remote endpoint of the edge through which b obtained
    # its label, or -1 if $b's base vertex is single.
    # If $v is a vertex inside a T-blossom and $label[$v] == 2,
    # $labelend[$v] is the remote endpoint of the edge through which $v is
    # reachable from outside the blossom.
    my @labelend = ( undef ) x (2*$nvertex);

    # If $v is a vertex,
    # $inblossom[$v] is the top-level blossom to which $v belongs.

lib/Graph/Matching.pm  view on Meta::CPAN

    # If $b is a (sub-)blossom,
    # $blossombase[$b] is its base VERTEX (i.e. recursive sub-blossom).\
    my @blossombase = ( 0 .. ($nvertex-1), ( undef ) x $nvertex );

    # If $b is a non-trivial (sub-)blossom,
    # $blossomendps[$b] refers to an array of endpoints on its connecting
    # edges, such that $blossomendps[$b]->[$i] is the local endpoint of
    # $blossomchilds[$b]->[$i] on the edge that connects it to
    # $blossomchilds[$b]->[wrap($i+1)].
    my @blossomendps = ( undef ) x (2*$nvertex);

    # If $v is a free vertex (or an unreached vertex inside a T-blossom),
    # $bestedge[$v] is the remote endpoint on a least-slack edge to an S-vertex
    # or -1 if there is no such edge.
    # If $b is a (possibly trivial) top-level S-blossom,
    # $bestedge[$b] is the remote endpoint on a least-slack edge to a
    # different S-blossom, or -1 if there is no such edge.
    # This is used for efficient computation of delta2 and delta3.
    my @bestedge = ( -1 ) x (2*$nvertex);

    # If $b is a non-trivial top-level S-blossom,
    # $blossombestedges[$b] refers to an array of remote endpoints on
    # least-slack edges to neighbouring S-blossoms, or is undef() if no
    # such list has been computed yet.
    # This is used for efficient computation of delta3.
    my @blossombestedges = ( undef ) x (2*$nvertex);

lib/Graph/Matching.pm  view on Meta::CPAN


    # slack($k)
    # returns 2 * slack of edge $k (does not work inside blossoms).
    local *slack = sub {
        my ($k) = @_;
        my $v = $endpoint[2*$k];
        my $w = $endpoint[2*$k+1];
        my $weight = $graph->[$k]->[2];
        return $dualvar[$v] + $dualvar[$w] - 2 * $weight;
    };

    # blossomleaves($b)

lib/Graph/Matching.pm  view on Meta::CPAN

    };

    # assignlabel($w, $t, $p)
    # assigns label $t to the top-level blossom containing vertex $w
    # and record the fact that $w was reached through the edge with
    # remote endpoint $p.
    local *assignlabel = sub {
        my ($w, $t, $p) = @_;
        DBG("assignlabel($w,$t,$p)") if ($DBG);
        my $b = $inblossom[$w];
        assert($label[$w] == 0 && $label[$b] == 0);

lib/Graph/Matching.pm  view on Meta::CPAN

            # $b became a T-blossom; assign label S to its mate.
            # (If b is a non-trivial blossom, its base is the only vertex
            # with an external mate.)
            my $base = $blossombase[$b];
            assert($mate[$base] >= 0);
            assignlabel($endpoint[$mate[$base]], 1, $mate[$base] ^ 1);
        }
    };

    # scanblossom($v, $w)
    # traces back from vertices $v and $w to discover either a new blossom

lib/Graph/Matching.pm  view on Meta::CPAN

            assert($labelend[$b] == $mate[$blossombase[$b]]);
            if ($labelend[$b] == -1) {
                # The base of blossom $b is single; stop tracing this path.
                $v = -1;
            } else {
                $v = $endpoint[$labelend[$b]];
                $b = $inblossom[$v];
                # $b is a T-blossom; trace one more step back.
                assert($label[$b] == 2);
                assert($labelend[$b] >= 0);
                $v = $endpoint[$labelend[$b]];
            }
            # Swap v and w so that we alternate between both paths.
            if ($w != -1) {
                my $t = $v;
                $v = $w;

lib/Graph/Matching.pm  view on Meta::CPAN

    # constructs a new blossom with given base, containing edge $k which
    # connects a pair of S vertices; labels the new blossom as S; sets its dual
    # variable to zero; relabels its T-vertices to S and adds them to the queue.
    local *addblossom = sub {
        my ($base, $k) = @_;
        my $v = $endpoint[2*$k];
        my $w = $endpoint[2*$k+1];
        my $bb = $inblossom[$base];
        my $bv = $inblossom[$v];
        my $bw = $inblossom[$w];
        # Create blossom.
        my $b = pop(@unusedblossoms);
        DBG("addblossom($base,$k) v=$v w=$w -> b=$b") if ($DBG);
        $blossombase[$b] = $base;
        $blossomparent[$b] = -1;
        $blossomparent[$bb] = $b;
        # Build lists of sub-blossoms and their interconnecting edge endpoints.
        my @path;
        my @endps;
        # Trace back from $v to $base.
        while ($bv != $bb) {
            # Add $bv to the new blossom.

lib/Graph/Matching.pm  view on Meta::CPAN

            unshift @path, $bv;
            unshift @endps, $labelend[$bv];
            # Trace one step back.
            assert($label[$bv] == 2 || ($label[$bv] == 1 && $labelend[$bv] == $mate[$blossombase[$bv]]));
            assert($labelend[$bv] >= 0);
            $v = $endpoint[$labelend[$bv]];
            $bv = $inblossom[$v];
        }
        # Add the base sub-blossom;
        # add the edge that connects the pair of S vertices.
        unshift @path, $bb;

lib/Graph/Matching.pm  view on Meta::CPAN

            push @path, $bw;
            push @endps, ($labelend[$bw] ^ 1);
            # Trace one step back.
            assert($label[$bw] == 2 || ($label[$bw] == 1 && $labelend[$bw] == $mate[$blossombase[$bw]]));
            assert($labelend[$bw] >= 0);
            $w = $endpoint[$labelend[$bw]];
            $bw = $inblossom[$w];
        }
        $blossomchilds[$b] = \@path;
        $blossomendps[$b] = \@endps;
        # Set new blossom's label to S.

lib/Graph/Matching.pm  view on Meta::CPAN

            if (!defined($blossombestedges[$bv])) {
                # This subblossom does not have a list of least-slack edges;
                # get the information from the vertices.
                foreach (blossomleaves($bv)) {
                    foreach my $p (@{$neighbend[$_]}) {
                        my $j = $endpoint[$p];
                        my $bj = $inblossom[$j];
                        if ($bj != $b && $label[$bj] == 1 &&
                            ($bestedgeto[$bj] == -1 ||
                             slack($p>>1) < slack($bestedgeto[$bj]>>1))) {
                            $bestedgeto[$bj] = $p;

lib/Graph/Matching.pm  view on Meta::CPAN

                    }
                }
            } else {
                # Walk this subblossom's least-slack edges.
                foreach my $p (@{$blossombestedges[$bv]}) {
                    my $j = $endpoint[$p];
                    my $bj = $inblossom[$j];
                    if ($bj != $b && $label[$bj] == 1 &&
                        ($bestedgeto[$bj] == -1 ||
                         slack($p>>1) < slack($bestedgeto[$bj]>>1))) {
                        $bestedgeto[$bj] = $p;

lib/Graph/Matching.pm  view on Meta::CPAN

                slack($p>>1) < slack($bestedge[$b]>>1)) {
                $bestedge[$b] = $p;
            }
        }
        DBG("blossomchilds[$b] = ", join(',', @path)) if ($DBG);
        DBG("blossomendps[$b]  = ", join('; ', map { $endpoint[$_] . "," . $endpoint[$_^1] } @{$blossomendps[$b]})) if ($DBG);
    };

    # expandblossom($b, $endstage)
    # expands the given top-level blossom.
    local *expandblossom = sub {

lib/Graph/Matching.pm  view on Meta::CPAN

            # blossom obtained its label, and relabel sub-blossoms until
            # we reach the base.
            # Figure out through which sub-blossom the expanding blossom
            # obtained its label initially.
            assert($labelend[$b] >= 0);
            my $entrychild = $inblossom[$endpoint[$labelend[$b] ^ 1]];
            # Decide in which direction we will go round the blossom.
            my $j = 0;
            my $jstep;
            $j++ until ($blossomchilds[$b]->[$j] == $entrychild);
            if ($j & 1) {

lib/Graph/Matching.pm  view on Meta::CPAN

            my $p = $labelend[$b];
            while ($j != 0) {
                # Relabel the T-sub-blossom.
                my $q = ($jstep == 1) ? ($blossomendps[$b]->[$j]) :
                                        ($blossomendps[$b]->[$j-1]^1);
                $label[$endpoint[$p^1]] = 0;
                $label[$endpoint[$q^1]] = 0;
                assignlabel($endpoint[$p^1], 2, $p);
                # Step to the next S-sub-blossom and note its forward endpoint.
                $allowedge[$q>>1] = 1;
                $j += $jstep;
                $p = ($jstep == 1) ? ($blossomendps[$b]->[$j]) :
                                     ($blossomendps[$b]->[$j-1]^1);
                # Step to the next T-sub-blossom.

lib/Graph/Matching.pm  view on Meta::CPAN

                $j += $jstep;
            }
            # Relabel the base T-sub-blossom WITHOUT stepping through to
            # its mate (so don't call assignlabel).
            my $bv = $blossomchilds[$b]->[$j];
            $label[$endpoint[$p^1]] = 2;
            $label[$bv] = 2;
            $labelend[$endpoint[$p^1]] = $p;
            $labelend[$bv] = $p;
            $bestedge[$bv] = -1;
            # Continue along the blossom until we get back to entrychild.
            $j += $jstep;
            while ($blossomchilds[$b]->[$j] != $entrychild) {

lib/Graph/Matching.pm  view on Meta::CPAN

                # label T to the sub-blossom.
                if (defined($v)) {
                    assert($label[$v] == 2);
                    assert($inblossom[$v] == $bv);
                    $label[$v] = 0;
                    $label[$endpoint[$mate[$blossombase[$bv]]]] = 0;
                    assignlabel($v, 2, $labelend[$v]);
                }
                $j += $jstep;
            }
        }

lib/Graph/Matching.pm  view on Meta::CPAN

            # Step to the next sub-blossom and augment it recursively.
            $j += $jstep;
            $t = $blossomchilds[$b]->[$j];
            my $p = ($jstep == 1) ? ($blossomendps[$b]->[$j]) :
                                    ($blossomendps[$b]->[$j-1]^1);
            augmentblossom($t, $endpoint[$p]) if ($t >= $nvertex);
            # Step to the next sub-blossom and augment it recursively.
            $j += $jstep;
            $t = $blossomchilds[$b]->[$j];
            augmentblossom($t, $endpoint[$p^1]) if ($t >= $nvertex);
            # Match the edge connecting those sub-blossoms.
            $mate[$endpoint[$p]] = $p ^ 1;
            $mate[$endpoint[$p^1]] = $p;
            DBG("PAIR ", $endpoint[$p], " ", $endpoint[$p^1], " k=", $p>>1) if ($DBG);
        }
        # Rotate the list of sub-blossoms to put the new base at the front.
        my $n = scalar(@{$blossomchilds[$b]});
        $blossomchilds[$b] = [ @{$blossomchilds[$b]}[$i .. ($n-1)],
                               @{$blossomchilds[$b]}[0 .. ($i-1)] ];

lib/Graph/Matching.pm  view on Meta::CPAN

    # swaps matched/unmatched edges over an alternating path between two
    # single vertices; the augmenting path runs through edge $k, which
    # connects a pair of S vertices.
    local *augmentmatching = sub {
        my ($k) = @_;
        my $v = $endpoint[2*$k];
        my $w = $endpoint[2*$k+1];
        DBG("augmentmatching($k) v=$v w=$w") if ($DBG);
        DBG("PAIR $v $w k=$k") if ($DBG);
        foreach my $p (2*$k+1, 2*$k) {
            my $s = $endpoint[$p^1];
            # Match vertex s to remote endpoint p. Then trace back from s
            # until we find a single vertex, swapping matched and unmatched
            # edges as we go.
            while (1) {
                my $bs = $inblossom[$s];
                assert($label[$bs] == 1 &&

lib/Graph/Matching.pm  view on Meta::CPAN

                augmentblossom($bs, $s) if ($bs >= $nvertex);
                # Update $mate[$s]
                $mate[$s] = $p;
                # Trace one step back.
                last if ($labelend[$bs] == -1); # stop at single vertex
                my $t = $endpoint[$labelend[$bs]];
                my $bt = $inblossom[$t];
                assert($label[$bt] == 2);
                # Trace one step back.
                assert($labelend[$bt] >= 0);
                $s = $endpoint[$labelend[$bt]];
                my $j = $endpoint[$labelend[$bt] ^ 1];
                # Augment through the T-blossom from j to base.
                assert($blossombase[$bt] == $t);
                augmentblossom($bt, $j) if ($bt >= $nvertex);
                # Update $mate[$j]
                $mate[$j] = $labelend[$bt];
                # Keep the opposite endpoint;
                # it will be assigned to $mate[$s] in the next step.
                $p = $labelend[$bt] ^ 1;
                DBG("PAIR $s $t k=", $p>>1) if ($DBG);
            }
        }

lib/Graph/Matching.pm  view on Meta::CPAN

            assert(!defined($_) || $_ >= 0);
        }
        # 0. all edges have non-negative slack and
        # 1. all matched edges have zero slack;
        foreach my $k (0 .. ($nedge-1)) {
            my $v = $endpoint[2*$k];
            my $w = $endpoint[2*$k+1];
            my $weight = $graph->[$k]->[2];
            my $s = $dualvar[$v] + $dualvar[$w] - 2 * $weight;
            my @vblossoms = ( $v );
            my @wblossoms = ( $w );
            push @vblossoms, $blossomparent[$vblossoms[-1]]

lib/Graph/Matching.pm  view on Meta::CPAN

        foreach my $b ($nvertex .. (2*$nvertex-1)) {
            if (defined($blossombase[$b]) && $dualvar[$b] > 0) {
                assert((scalar(@{$blossomendps[$b]}) & 1) == 1);
                for (my $j = 1; $j <= $#{$blossomendps[$b]}; $j += 2) {
                    my $p = $blossomendps[$b]->[$j];
                    assert($mate[$endpoint[$p]] == ($p^1));
                    assert($mate[$endpoint[$p^1]] == $p);
                }
            }
        }
        # Ok.
    };

lib/Graph/Matching.pm  view on Meta::CPAN

    local *checkdelta2 = sub {
        foreach my $v (0 .. ($nvertex-1)) {
            if ($label[$inblossom[$v]] == 0) {
                my $bd;
                foreach my $p (@{$neighbend[$v]}) {
                    my $w = $endpoint[$p];
                    if ($label[$inblossom[$w]] == 1) {
                        my $d = slack($p >> 1);
                        $bd = $d if (!defined($bd) || $d < $bd);
                    }
                }

lib/Graph/Matching.pm  view on Meta::CPAN

        foreach my $b (0 .. (2*$nvertex-1)) {
            if (defined($blossomparent[$b]) && $blossomparent[$b] == -1 &&
                $label[$b] == 1) {
                foreach my $v (blossomleaves($b)) {
                    foreach my $p (@{$neighbend[$v]}) {
                        my $w = $endpoint[$p];
                        if ($inblossom[$w] != $b && $label[$inblossom[$w]] == 1) {
                            my $d = slack($p>>1);
                            $bd = $d if (!defined($bd) || $d < $bd);
                        }
                    }
                }
                if ($bestedge[$b] != -1) {
                    my $w = $endpoint[$bestedge[$b]];
                    my $v = $endpoint[$bestedge[$b]^1];
                    assert($inblossom[$v] == $b);
                    assert($inblossom[$w] != $b);
                    assert($label[$inblossom[$w]] == 1 && $label[$inblossom[$v]] == 1);
                    my $d = slack($bestedge[$b]>>1);
                    $tbd = $d if (!defined($tbd) || $d < $tbd);

lib/Graph/Matching.pm  view on Meta::CPAN

                assert($label[$inblossom[$v]] == 1);

                # Scan its neighbours:
                foreach my $p (@{$neighbend[$v]}) {
                    # w is a neighbour to v
                    my $w = $endpoint[$p];
                    # ignore blossom-internal edges
                    next if ($inblossom[$v] == $inblossom[$w]);
                    # check whether edge has zero slack
                    my $kslack;
                    if (!$allowedge[$p>>1]) {

lib/Graph/Matching.pm  view on Meta::CPAN

                # No further improvement possible; optimum reached.
                last;
            } elsif ($deltatype == 2) {
                # Use the least-slack edge to continue the search.
                $allowedge[$deltaedge>>1] = 1;
                my $v = $endpoint[$deltaedge];
                assert($label[$inblossom[$v]] == 1);
                push @queue, $v;
            } elsif ($deltatype == 3) {
                # Use the least-slack edge to continue the search.
                $allowedge[$deltaedge>>1] = 1;
                my $v = $endpoint[$deltaedge];
                assert($label[$inblossom[$v]] == 1);
                DBG("PUSH $v") if ($DBG);
                push @queue, $v;
            } elsif ($deltatype == 4) {
                # Expand the least-z blossom.

lib/Graph/Matching.pm  view on Meta::CPAN


    # Return %ret such that $ret[$v] is the vertex to which $v is paired.
    my %ret;
    for (my $v = 0; $v < $nvertex; $v++) {
        if ($mate[$v] != -1) {
            assert($endpoint[$mate[$endpoint[$mate[$v]]]] == $v);
            $ret{$nodelist[$v]} = $nodelist[$endpoint[$mate[$v]]];
        }
    }

    undef @nodelist;
    undef %nodemap;
    undef @endpoint;
    undef @neighbend;
    undef @mate;
    undef @label;
    undef @labelend;
    undef @inblossom;

 view all matches for this distribution


Graph

 view release on metacpan or  search on metacpan

lib/Graph/TransitiveClosure/Matrix.pm  view on Meta::CPAN

		}
		$si[$iu]->[$iv] = $V[$iv] unless $iu == $iv;
	    }
	}
    }
    # naming here is u = start, v = midpoint, w = endpoint
    for (my $iv = $#V; $iv >= 0; $iv--) {
	my $div = $di[$iv];
	my $aiv = $ai[$iv];
	for (my $iu = $#V; $iu >= 0; $iu--) {
	    my $aiu = $ai[$iu];

 view all matches for this distribution


( run in 1.497 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )