Skip to main content
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 ...
Chechy Levas's user avatar
  • 2,310
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 ...
dlp_dev's user avatar
  • 148
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 ...
RobSim's user avatar
  • 41
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 ...
Lola's user avatar
  • 21
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][...
ABGR's user avatar
  • 5,059
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 ...
VampX Helix's user avatar
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 ...
leaf's user avatar
  • 25
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 ...
DeejC's user avatar
  • 139
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 ...
Gregory Desrosiers's user avatar
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 ...
PeterMouse's user avatar
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 ...
01xz's user avatar
  • 1
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 ...
anon60707's user avatar
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 ...
snowcoffeebean's user avatar
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 ...
Mark Lavin's user avatar
  • 1,142
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 ...
Paul Ivanov's user avatar

15 30 50 per page
1
2 3 4 5
22