Hi!
This project aims to show course prerequisites in a graph form to make it easier to explore courses.
Check it out at https://andersontseng.ca/prerequisites-visualization.
Please note that the data does contain errors and omissions. As well, the data from UBC predates the workday migration, and the Langara and SFU data are not being actively updated (data was generated in July 2025). Please consult with your institutions page for the most accurate information. <3
Stack:
- Next.js, Tailwind, Sigma.js
Thanks to:
- SFU for making their course data available by API.
- UBCFinder and ubcexplorer.io (defunct) for making UBC course data available.
An interactive graph visualization tool built with Next.js and React Sigma for visualizing course prerequisites and dependencies. Features dynamic CSV data loading, force-directed layouts, and comprehensive interactive controls.
- Interactive Graph Visualization: Built with Sigma.js and React Sigma for smooth, performant rendering
- CSV Data Support: Load nodes and links from CSV files for easy data management
- Force-Directed Layout: Uses Force Atlas 2 algorithm for optimal node positioning
- Dynamic Color Coding: Automatically color-codes nodes by group using consistent hashing
- Interactive Controls:
- 🔍 Search: Find and focus on specific nodes
- 🔍 Zoom: Zoom in/out and reset view
- 📺 Fullscreen: Toggle fullscreen mode
- 🗺️ Minimap: Navigate large graphs easily
- Hover Effects:
- Highlight connected nodes and edges
- Hide labels for unconnected nodes
- Visual focus on relationships
- Responsive Design: Works on desktop and mobile devices
- Static Export: Deployable to GitHub Pages and other static hosting
- Framework: Next.js 15 with TypeScript
- Visualization: Sigma.js + React Sigma
- Graph Processing: Graphology
- Layout Algorithm: Force Atlas 2
- Data Parsing: PapaParse (CSV)
- Styling: Tailwind CSS
- Icons: React Icons
- Package Manager: Bun
-
Clone the repository:
git clone https://github.com/yourusername/prerequisites-visualization.git cd prerequisites-visualization -
Install dependencies:
bun install
-
Run the development server:
bun dev
-
Open your browser and navigate to
http://localhost:3000
id,group,size
MATH101,Mathematics,3
PHYS101,Physics,2
CMPT120,Computing Science,4
source,target,value
MATH101,PHYS101,1
MATH101,CMPT120,1
The project includes a GitHub Actions workflow for automatic deployment to GitHub Pages:
- Push to main branch - deployment happens automatically
- Manual deployment - use the "Actions" tab in GitHub
Build the static export:
bun run buildDeploy the out/ folder to your preferred static hosting service.
- Navigation: Use mouse/touch to pan around the graph
- Zoom: Use scroll wheel or zoom controls
- Search: Type node names in the search box to find and focus on specific nodes
- Hover: Hover over nodes to see connections and hide unrelated labels
- Fullscreen: Click the fullscreen button for immersive viewing
Modify graph behavior in src/app/sfu/graph.tsx:
// Force Atlas 2 Layout Settings
const positions = forceAtlas2(graph, {
iterations: 300,
settings: {
gravity: 1,
scalingRatio: 10,
strongGravityMode: false,
barnesHutOptimize: true,
// ... more settings
}
});Customize rendering in the SigmaContainer settings:
settings={{
allowInvalidContainer: true,
renderLabels: true,
defaultEdgeType: 'arrow',
minCameraRatio: 0.005,
maxCameraRatio: 1.5,
}}├── src/
│ ├── app/
│ │ ├── sfu/
│ │ │ └── graph.tsx # Main graph component
│ │ ├── page.tsx # Home page
│ │ └── layout.tsx # Root layout
│ ├── components/
│ │ └── FocusOnNode.tsx # Node focusing utility
│ ├── types/
│ │ └── graph.ts # TypeScript types
│ └── utils/
│ └── colors.ts # Color generation utilities
├── public/
│ └── data/
│ └── sfu/
│ ├── nodes.csv # Node data
│ └── links.csv # Edge data
└── .github/
└── workflows/
└── nextjs.yml # GitHub Pages deployment
