Skip to content

Data Structures and Algorithms

Santhosh Kumar Devadoss edited this page Oct 19, 2023 · 4 revisions

Graph

Topological Sorting

Directed Acyclic Graphs:

  • Not every graph can have a topological ordering. A graph which contains a cycle cannot have a valid ordering.
  • The only type of graph which as a valid topological ordering is a Directed Acyclic Graph (DAG). These are graphs with directed edges and no cycles.
  • By definition, all rooted trees have a topological ordering since they do not contain any cycles.
Clone this wiki locally