gtfs2graph
Convert from any graph formatto gtfs2graph Convert from gtfs2graphto any other format
gtfs2graph is a command-line application that converts a public-transit feed in the General Transit Feed Specification (GTFS) into graph representations. It was written by Franz-Benjamin Mocnik (copyright 2015-2018) and is implemented entirely in Haskell, built from source with the Cabal package manager. The tool is released under the GPL-3.0 license and lives in the mocnik-science/gtfs2graph GitHub repository, where it is a small, largely inactive project with only a handful of commits and no tagged releases.
The tool derives two kinds of networks from a GTFS feed. The connectivity network treats each stop or station as a node and draws an edge between successive stops of the same trip; this abstract graph is exported to GraphML. The shaped network augments that structure with the geographic shape of each connection (from the GTFS shapes data) and is rendered as an SVG image rather than a graph file. The two outputs are produced by the graphml and svg subcommands respectively.
Edges in the GraphML export can be weighted in three ways, selected with the -w/--weighttype flag: travel time between successive stops (the default), network distance actually traversed (noted as computationally expensive), or straight-line distance in space that ignores the network path. When several trips create parallel edges between the same pair of stops, the smallest weight is kept. The SVG command offers presentation flags for line width, per-mode colors, canvas size, title, and background, plus weight-driven styling and a --handle-broken-csv option that tolerates malformed feed data.
Within the graph-data and format-conversion landscape, gtfs2graph occupies a narrow, single-purpose niche: turning a transit schedule into a topology graph or a static map. Its GraphML output is directly consumable by general graph tools such as NetworkX, igraph, Gephi, and Cytoscape, and can be further transcoded with converters like GraphInOut. It overlaps in intent with other GTFS-to-network tools such as gtfs2nx and peartree, though those target Python and NetworkX directly.
Its main limitations follow from its deliberately minimal scope. gtfs2graph builds only static connectivity structures; it performs no route planning, journey calculation, or timetable-aware (temporal) analysis, so the schedule's time dimension is collapsed into edge weights rather than preserved. The Haskell/Cabal build requirement and the dormant codebase also make it less approachable than script-language alternatives for most users today.
Input Formats
Output Formats
Frequently Asked Questions
What graph file formats does gtfs2graph support?
See the list on this page — it shows every format gtfs2graph can read, write and display.
How do I import a graph into gtfs2graph?
Convert your file to a format gtfs2graph can read, then open it in gtfs2graph. Use GraphInOut to get a gtfs2graph-compatible file in seconds.
How do I convert a file so gtfs2graph can open it?
Use the convert links above — upload or paste your graph, pick a format gtfs2graph accepts and download the result, right in your browser.
