Skip to content

peartree: A library for converting transit data into a directed graph for sketch network analysis.

License

Notifications You must be signed in to change notification settings

CalthorpeAnalytics/peartree

 
 

Repository files navigation

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

Combining a peartree transit network and an OpenStreetMap walk network

Generating comparative acyclic route graphs

Coalescing transit network graphs and spectral clustering methods

Exploratory graph analysis with betweenness and load centrality

About

peartree: A library for converting transit data into a directed graph for sketch network analysis.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.9%
  • Dockerfile 2.4%
  • Makefile 0.7%