What I did

I used OSMnx to download Hong Kong’s road graph from OpenStreetMap and analysed it with NetworkX. I explored how different centrality measures (degree, betweenness and closeness) highlight important streets and junctions, and I tested shortest‑path routing on the network.

Data & tools

OSMnx let me query OpenStreetMap for Hong Kong’s drivable network and turn it into a directed multigraph. With NetworkX I computed metrics and paths; Pandas helped with tidy tables; Matplotlib handled plots.

import osmnx as ox
import networkx as nx
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

Workflow

  1. Download the road graph for Hong Kong with OSMnx.
  2. Clean and simplify edges; ensure one giant connected component for analysis.
  3. Compute centrality: degree, betweenness, closeness.
  4. Route between points using Dijkstra on edge lengths.
  5. Visualise the results as high‑contrast maps.

Centrality — quick explainer

Degree

How many edges meet at a node. Busy junctions score higher.

Betweenness

Nodes/streets that sit on lots of shortest paths. Good for spotting potential bottlenecks.

Closeness

How near a node is to all others, on average. Useful for overall accessibility.

What worked

  • Got a clean Hong Kong road graph and produced high‑contrast visuals.
  • Ran degree, betweenness and closeness on sample networks.
  • Implemented shortest‑path routing and inspected the path geometry.

Challenges

  • Incomplete transit line in a separate subway test graph led to layout issues (node positions).
  • Needed careful handling of node positions for consistent plotting.
  • Some tasks depended on internet access to fetch data.

What I learnt

Tech notes

This project is summarised from two Jupyter notebooks (“RoadNetwork.ipynb” and a day‑by‑day logbook). The page avoids going beyond those topics and keeps to road‑graph extraction, centrality (degree/betweenness/closeness), routing, and visualisation.

See more

The full Jupyter notebooks for this project are available on GitHub: github.com/YaanAragon/Hong_Kong_network .