MHB Topological Sort: Finding a Contradiction

  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Sort Topological
AI Thread Summary
The discussion focuses on the concept of topological sorting in directed graphs, emphasizing the need to arrange nodes in a linear order where all directed edges point from left to right. It highlights the distinction between a graph and its embedding, noting that the left-right positioning of vertices is relevant only in the context of a specific embedding. An equivalent definition of topological sorting is provided, which states that a linear order exists such that if there is an edge from vertex u to vertex v, then u precedes v in the order. The notation used in the discussion is clarified, with d(u) representing the discovery time of vertex u and f(u) indicating its finishing time, both of which are determined using the Depth-First Search (DFS) algorithm. The algorithm for topological sorting is outlined, involving the computation of finishing times for all vertices and organizing them into a linked list based on their completion.
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: 94
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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top