What does topological sorting primarily aim to do in a directed graph?

  • Arranges the vertices in a linear order such that for every directed edge (u, v), vertex u comes before vertex v in the order.
  • Finds the shortest path between two vertices in the graph.
  • Identifies cycles in the graph.
  • Rearranges the vertices randomly.
Topological sorting in a directed graph aims to arrange the vertices in a linear order such that for every directed edge (u, v), vertex u comes before vertex v in the order. This order is often used to represent dependencies between tasks or events.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *