Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Peartree is a library for converting GTFS to directed graphs.

Project description

Peartree is a library for converting GTFS feed schedules into a representative directed network graph. The tool uses Partridge to convert the target operator schedule data into Pandas dataframes and then NetworkX to hold the manipulated schedule data as a directed multigraph.

Above, an example of multiple Bay Area transit operators being incrementally loaded into Peartree.


pip install peartree


See a full notebook at this gist to see a simple, step-by-step iPython Notebook pulling in an AC Transit GTFS feed and converting it to a NetworkX graph.

import peartree as pt

path = 'path/to/'

# Automatically identify the busiest day and
# read that in as a Partidge feed
feed = pt.get_representative_feed(path)

# Set a target time period to
# use to summarize impedance
start = 7*60*60  # 7:00 AM
end = 10*60*60  # 10:00 AM

# Converts feed subset into a directed
# network multigraph
G = pt.load_feed_as_graph(feed, start, end)


I’ve yet to produce a full how-to guide for this library, but will begin to populate this section with any blog posts or notebooks that I or others produce, that include workflows using Peartree.

Calculating betweeness centrality with Brooklyn bus network

Generating comparative acyclic route graphs

Coalescing transit network graphs and spectral clustering methods

Exploratory graph analysis with betweenness and load centrality

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
peartree-0.5.1-py2.py3-none-any.whl (29.6 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jul 28, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page