The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Algorithm::ScheduledPath::Path - path class for Algorithm::ScheduledPath

DESCRIPTION

This is a class for managine paths (ordered sets of edges) in Algorithm::ScheduledPath.

Methods

new
add_leg
first_leg
last_leg
depart_time
arrive_time
travel_time
get_legs
  @edges = @{ $path->get_legs };

Returns a reference to an array containing the component Algorithm::ScheduledPath::Edge objects.

num_legs
  $size = $path->num_legs;

Returns the number of legs (edges) in the path.

compressed
  $cpath = $path->compressed;

Produces a "compressed" version of the path, where sequential edges (legs) sharing the same path identifier are merged. The result may be a path with "virtual" edges.

For instance, if the path represents a route one might take on a bus line, where the path identifier refers to bus routes, then the compressed version would merge bus stops on the same route so as to make it easier to identify where one needs to transfer to different bus lines. (One could also use this to facilitate analysis of the number of transfers.)

AUTHOR

Robert Rothenberg <rrwo at cpan.org>

LICENSE

Copyright (c) 2004 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.