# Topological Sort ![](Topological%20sort%20and%20embeddings%202.png) ### Etymology Graph theory was originally (and still sometimes is, depending on who you ask) considered a branch of topology. This may sound strange to people with a modern education, where "topology" means more or less "the part of mathematics that deals abstractly with continuity and limits, without using real numbers" -- or at least without giving the real numbers any central position in the theory. However, earlier on, "topology" appears to have been a catch-all term for "the part of mathematics that isn't about numbers or geometric magnitudes". (This was before algebraists stopped pretending that algebra is necessarily about numbers). Only later did a distinction between what we now call topology and discrete mathematics become common. > In this old usage, **topological sorting** simply means **the kind of sorting you can define without reference to comparison of numbers**. For a further intuition, read up on these nice summaries: * [Topological Spaces, Metric Spaces and Graphs](Topological%20Spaces,%20Metric%20Spaces%20and%20Graphs.md) * [Differential-Geometry-Topology-Manifolds-Matt-Grimes](Differential-Geometry-Topology-Manifolds-Matt-Grimes.md) To summarize, recall that: * **Topology** is really the concept of 'nearness'. * What we really need is a definition of _closeness_. _That_ is the point of **topology**. Given a set (think nodes) if we equip it with a topology (think edges) then we can do math with only the notion of *closeness*. --- Date: 20211020 Links to: [Graph-Algorithms](Graph-Algorithms.md) [Depth-First-Search](Depth-First-Search.md) [Partial-Order](Partial-Order.md) Tags: References: * Algorithm Design Manual * Algorithms Illuminated volume 2 * [Relationship to partial ordering](https://en.wikipedia.org/wiki/Topological_sorting)