NAME
    Map::Metro - Public transport graphing

SYNOPSIS
        # Install a map
        $ cpanm Map::Metro::Plugin::Map::Stockholm

        # And then
        my $graph = Map::Metro->new('Stockholm', hooks => ['PrettyPrinter'])->parse;

        my $routing = $graph->routes_for('Universitetet', 'Kista');

    prints

        From Universitetet to Kista
        ===========================

        -- Route 1 (cost 15) ----------
        [   T14 ] Universitetet
        [   T14 ] Tekniska högskolan
        [   T14 ] Stadion
        [   T14 ] Östermalmstorg
        [   T14 ] T-Centralen
        [ * T11 ] T-Centralen
        [   T11 ] Rådhuset
        [   T11 ] Fridhemsplan
        [   T11 ] Stadshagen
        [   T11 ] Västra skogen
        [   T11 ] Solna centrum
        [   T11 ] Näckrosen
        [   T11 ] Hallonbergen
        [   T11 ] Kista

        T11  Blue line
        T14  Red line

        *: Transfer to other line
        +: Transfer to other station

DESCRIPTION
    The purpose of this distribution is to find the shortest unique
    route/routes between two stations in a transport network.

  Methods
   new($city, hooks => [])
    $city

    The name of the city you want to search connections in. Mandatory,
    unless you are only going to call "available_maps".

    $hooks

    Array reference of Hooks that listens for events.

   parse()
    Returns a Map::Metro::Graph object containing the entire graph.

   available_maps()
    Returns an array reference containing the names of all Map::Metro maps
    installed on the system.

  What is a unique path?
    The following rules are a guideline:

    If the starting station and finishing station...

    ...is on the same line there will be no transfers to other lines.

    ...shares multiple lines (e.g., both stations are on both line 2 and 4),
    each line constitutes a route.

    ...are on different lines a transfer will take place at a shared
    station. No matter how many shared stations there are, there will only
    be one route returned (but which transfer station is used can differ
    between queries).

    ...has no shared stations, the shortest route/routes will be returned.

MORE INFORMATION
    Map::Metro::Graph - How to use graph object.

    Map::Metro::Plugin::Map - How to make your own maps.

    Map::Metro::Hook - How to extend Map::Metro via hooks/events.

    Map::Metro::Cmd - A guide to the command line application.

    Map::Metro::Graph::Connection - Defines a MMG::Connection.

    Map::Metro::Graph::Line - Defines a MMG::Line.

    Map::Metro::Graph::LineStation - Defines a MMG::LineStation.

    Map::Metro::Graph::Route - Defines a MMG::Route.

    Map::Metro::Graph::Routing - Defines a MMG::Routing.

    Map::Metro::Graph::Segment - Defines a MMG::Segment.

    Map::Metro::Graph::Station - Defines a MMG::Station.

    Map::Metro::Graph::Step - Defines a MMG::Step.

    Map::Metro::Graph::Transfer - Defines a MMG::Transfer.

  Hierarchy
    The following is a conceptual overview of the various parts of a graph:

    At first, the map file is parsed. The four types of blocks (stations,
    transfers, lines and segments) are translated into their respective
    object.

    Next, lines and stations are put together into LineStations. Every two
    adjacent LineStations are put into two Connections (one for each
    direction).

    Now the network is complete, and it is time to start traversing it.

    Once a request to search for paths between two stations is given, we
    first search for the starting Station given either a station id or
    station name. Then we find all LineStations for that station.

    Then we do the same for the destination station.

    And then we walk through the network, from LineStation to LineStation,
    finding their Connections and turning them into Steps, which we then add
    to the Route.

    All Routes between the two Stations are then put into a Routing, which
    is returned to the user.

Status
    This is somewhat experimental. I don't expect that the map file format
    will *break*, but it might be extended. Only the documented api should
    be relied on, though breaking changes might occur.

    For all maps in the Map::Metro::Plugin::Map namespace (unless noted):

    These maps are not an official source. Use accordingly.
    Each map should state its own specific status with regards to coverage
    of the transport network.

COMPATIBILITY
    Currently only Perl 5.20+ is supported.

    Map::Tube works with Perl 5.6.

    Included in this distribution is a script to convert "Map::Metro" maps
    into "Map::Tube" maps, if Map::Tube misses one you need.

BUGS & ISSUES
    The repository and issue tracker is at:
    <https://github.com/Csson/p5-Map-Metro>

SEE ALSO
    Map::Tube

AUTHOR
    Erik Carlsson <info@code301.com>

COPYRIGHT
    Copyright 2014 - Erik Carlsson

LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

