# Topological Sorting solved by 334

Feb. 21, 2014, 5:37 p.m. by Rosalind Team

Topics: Graphs

## Problem

Given: A simple directed acyclic graph with $n \le 10^3$ vertices in the edge list format.

Return: A topological sorting (i.e., a permutation of vertices) of the graph.

4 5
1 2
3 1
3 2
4 3
4 2

4 3 1 2

## Visualization

Visualization by David Galles: http://www.cs.usfca.edu/~galles/visualization/ConnectedComponent.html.