Graph, Graph Algorithm, and Klang Valley Transit Routing
Project description
Klang Valley Transit
Installation
- install from PyPI
pip install klang-valley-transit
sample use case
- LRT and MRT station Listing
from klang_valley_transit.trainNetwork import TrainNetwork
from klang_valley_transit.trainNetwork import SearchFilter, LineNameEnum
# initiate the instance
t = TrainNetwork()
# List all LRT and MRT stations
s,err = t.ListStation(SearchFilter(line_name="*"))
if err: raise Exception(err)
print(s)
# List LRT or MRT stations where LineName is AMPANG_LRT
s,err = t.ListStation(SearchFilter(line_name=LineNameEnum.AG))
if err: raise Exception(err)
print(s)
# List AMPANG LRT where the code is AG11
s,err = t.ListStation(SearchFilter(line_name=LineNameEnum.AG, code="AG11"))
if err: raise Exception(err)
print(s)
# Search from all AMPANG LRT stations where station name like sentul
s,err = t.ListStation(SearchFilter(line_name=LineNameEnum.AG, station_name="sentul"))
if err: raise Exception(err)
print(s)
- MRT and LRT station routing
from klang_valley_transit.trainNetwork import TrainNetwork
# initiate the instance
t = TrainNetwork()
# getting 2 random station id
[fromID,toID], error = t.getRandomVerticesID(2)
if error: print(error)
print(fromID,toID)
# routing the station base on ID
res,err = t.breadthFirstSearch(fromID,toID)
if err : raise Exception(err)
print("explored : ",res.explored )
print("path : ",res.path)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
klang_valley_transit-1.0.2.tar.gz
(24.9 kB
view hashes)
Built Distribution
Close
Hashes for klang_valley_transit-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b2ba5019e8745db3c9a3d2ef356b77b6ed121f3286b8df360e3eb31e2d7e535 |
|
MD5 | b8708043b6af4f24c46ba0c903a13dca |
|
BLAKE2b-256 | c7ca0a4fa9e2fe425373dfcdd59bdb5e731ea989d0da699502a07384c06c0cb6 |
Close
Hashes for klang_valley_transit-1.0.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92b3ad716bbe22f7311ec8df6c09c3c26dea1bf844040bc79161090d4b005163 |
|
MD5 | 795646f98d91d00593e157daacae0752 |
|
BLAKE2b-256 | 2b01d5b96101264bf243f7f65dd8f623b392f19eaa03d58ee1a2bf5846425bc1 |