Topological Sort: Finding a Contradiction

  • Context: MHB 
  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Sort Topological
Click For Summary
SUMMARY

The discussion centers on the topological sort of a directed graph, emphasizing the need for a linear order of vertices such that if there is an edge from vertex u to vertex v, then u precedes v. It clarifies that the topological sort can be defined without reference to graph embeddings, focusing instead on the discovery time d(u) and finishing time f(u) of nodes, which are computed using the Depth-First Search (DFS) algorithm. The provided algorithm for topological sorting involves computing finishing times for all vertices and organizing them into a linked list.

PREREQUISITES
  • Understanding of directed graphs and their properties
  • Familiarity with Depth-First Search (DFS) algorithm
  • Knowledge of graph theory terminology, including discovery and finishing times
  • Basic understanding of linked lists and their implementation
NEXT STEPS
  • Study the implementation of the Depth-First Search (DFS) algorithm in various programming languages
  • Learn about graph embeddings and their implications in graph theory
  • Explore advanced topics in topological sorting, such as Kahn's algorithm
  • Investigate applications of topological sorting in scheduling and dependency resolution
USEFUL FOR

Computer scientists, software engineers, and students studying algorithms and data structures, particularly those interested in graph theory and its applications in programming.

evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)

The topological sort of a graph can be considered as an order of its nodes along a horizontal line so that all the directed edges go from the left to the right.

How could we show that all the directed edges go fom the left to the right?

We suppose that it is:

View attachment 3843

Then it holds that $[d(w),f(w)] \subset [d(u),f(u)]$, right? (Thinking)

How could we find a contradiction?
 

Attachments

  • graph4.png
    graph4.png
    1.5 KB · Views: 110
Technology news on Phys.org
There is a distinction between a graph and its embedding in the plane. One cannot ask whether this vertex lies to the left of that vertex when talking about a graph, but this is a legitimate question about an embedding. The definition of the topological sort refers to a particular embedding of the given graph where all vertices lie on a line. It is possible to give an equivalent definition that does not refer to embeddings: simply require that there is a linear order $<$ on vertices such that the existence of an edge from $u$ to $v$ implies $u<v$.

evinda said:
Then it holds that $[d(w),f(w)] \subset [d(u),f(u)]$, right?
Could you explain the notation used in this formula?
 
Evgeny.Makarov said:
Could you explain the notation used in this formula?
[m] d(u) [/m] is the discovery time of the node [m] u [/m], the first time we visit it.
[m] f(u) [/m] is the finishing time of the node [m] u [/m], the time when it can be considered discovered.

We find these values using the [m] DFS [/m] algorithm.

This the algorithm that it given for the topological sort:
Code:
TOPOLOGICALSORT(G)
1. Call DFS(G) to compute finishing times f(v),  for all v in V.
2. When a vertex is finished put it in front of a linked list.
3. return the linked list of vertices.
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 58 ·
2
Replies
58
Views
5K
  • · Replies 46 ·
2
Replies
46
Views
8K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K