327
questions
0
votes
0
answers
29
views
How to visit all reachable nodes between 2 points in topological order, visiting each edge once?
I have a directed (potentially cyclic) graph. Some nodes are inputs and some nodes are outputs. I want to iterate over all the edges that form paths between an input and an output. I want to ignore ...
0
votes
1
answer
78
views
Handling cycles in topological sorting in T-SQL
I've been trying to write a T-SQL script - I am aware it's probably not the best tool for this scenario - that can do a topological sort given a table of nodes and their edges.
I've eventually come up ...
1
vote
0
answers
72
views
CSAPP 3e (global): Possible erratum for "Practice Problem 8.3" (p. 781)?
Due to the relative lack of popularity of CSAPP's global edition, I have been unable to figure out whether exercise problem 8.3 (partial screenshots shown above) is entirely correct. I have only found ...
2
votes
1
answer
69
views
Topological Sort as Reverse Post-DFS | Course Schedule II LeetCode
Currently solving Course Schedule II on LeetCode and this is the code that DOES NOT pass all test cases because of the following line: Collections.reverse(postOrder);. Removing this line solves all ...
1
vote
0
answers
59
views
Shortest path in Directed Acyclic Graph. Is topological Sort Really needed?
Here's a famous problem:
Given a Directed Acyclic Graph of N vertices from 0 to N-1 and a 2D Integer array(or vector) edges[ ][ ] of length M, where there is a directed edge from edge[i][0] to edge[i][...
0
votes
0
answers
36
views
Topological Sorting question. Does the values of an edge impact the order in which they are sorted?
I am currently working on the "Longest Road" Dag problem, and finished writing my topological sorting algorithm in Java. Currently I am using edges with no value associated to them, and I am ...
2
votes
1
answer
163
views
Generate Random Topological Sort of Graph in Python?
As we all know, topological sorts are not unique. A graph can have many topological sorts. For example, the graph {A, B, C}, {(A,C)} has exactly three sorts: {A,B,C}, {B,A,C}, and {A,C,B}.
My problem ...
0
votes
0
answers
82
views
How to detect separate chains in a topological sort
EDIT:
My question was originally about how to sort the following data. I was pointed in the direction of topological sort which got me started, but I am editing the question now to my new issue.
Given ...
0
votes
0
answers
17
views
Topological Sort - Usual Ordering of First Source Nodes Added to Queue
I am reviewing the 14 coding interview patterns by Fahim ul Haq; what is the usual ordering, or orderings, of source nodes that are added to the source queue in topological sorting?
Suppose I have ...
0
votes
1
answer
95
views
How to get reasonable "topological order" of control flow graph (CFG) which may have loops when calculating MD index?
I am a noob in binary analysis and I am looking for your help.
I am working on calculating the MD index of callgraph function nodes by Python, and I have to analyze the control flow graph (CFG) inside ...
0
votes
0
answers
23
views
Select vertex on DAG and ensure topological sorting depth in limit
Given a directed acyclic graph, some node's indegree are zero.
I want to select some other nodes and set their indegree to zero mannual, then perform topological sorting on the directed graph and ...
0
votes
0
answers
37
views
Checking if there exists an edge in constant time
Original Question: Algorithm for finding a Hamiltonian Path in a DAG
Chosen Answer:
You can first topologically sort the DAG (every DAG can be topologically sorted) in O(n+m).
Once this is done, you ...
0
votes
1
answer
39
views
How to find the ideal topological ordering (fewest steps as explained in description below)?
Given a network of N computers, there are N-1 cables that connect the computers into a tree. A message is passed to computer 1 and it will propogate it to its neighbouring computers and so on until ...
0
votes
0
answers
31
views
How do I topologically sort a rooted tree from the "parentOf" relation?
I have a N-node rooted tree whose nodes are labeled 0 through N-1. I am given the parentOf relation, that is, for each node i, parentOf[i] is the single node j such that j is the parent of i. I ...
0
votes
0
answers
146
views
pytorch and topological sorting
I want to understand in which cases and how (automatically, when model is built, or not) PyTotch uses topological sorting.
I can't check it manually, cause of some circumstances, so I've tried ...