Peartree: A library for converting transit data into a directed graph for network analysis.
Python Makefile
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docker Add htop to Dockerfile (#69) May 6, 2018
examples example image Nov 22, 2017
peartree Version bump (#78) Jun 6, 2018
performance [performance] Utilize mp.BaseManager to share reference object among … Apr 11, 2018
tests Adjust the way plot method uses MPL (#75) Jun 4, 2018
.gitignore Custom stop coordinates for synthetic routes (#72) May 31, 2018
.pre-commit-config.yaml Running pre-commit, reformatting all files Nov 24, 2017
.travis.yml Switch from coveralls to codecov (#33) Mar 6, 2018
Dockerfile Docker, Jp notebook configurations (#15) Feb 16, 2018
HISTORY.rst Prepare for v0.4.0 bump (#67) Apr 22, 2018
LICENSE Update MIT license Jan 4, 2018
Makefile Assorted code gardening (#70) May 7, 2018
README.rst Minor update: Relax requirements (#76) Jun 6, 2018
docker-compose.yml Docker, Jp notebook configurations (#15) Feb 16, 2018
jupyter_notebook_config.py Docker, Jp notebook configurations (#15) Feb 16, 2018
pre-commit-reqs.txt
requirements.txt Minor update: Relax requirements (#76) Jun 6, 2018
requirements_dev.txt [notebook] Update dev dependencies for make notebook (#38) Mar 14, 2018
setup.cfg Running pre-commit, reformatting all files Nov 24, 2017
setup.py Version bump (#78) Jun 6, 2018

README.rst

Peartree 🍐🌳

https://img.shields.io/travis/kuanb/peartree.svg?branch=master

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.

https://raw.githubusercontent.com/kuanb/peartree/master/examples/example.gif

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

Installation

pip install peartree

Usage

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/actransit_gtfs.zip'

# 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)

Examples

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