Questions tagged [kosaraju-sharir]

4 questions
11
votes
5 answers

kosaraju finding finishing time using iterative dfs

here is the first part of the code that i have did for Kosaraju's algorithm. ###### reading the data ##### with open('data.txt') as req_file: ori_data = [] for line in req_file: line = line.split() if line: …
user 3317704
  • 925
  • 2
  • 10
  • 21
2
votes
1 answer

Order of steps in Kosaraju's algorithm

The Wikipedia summary of the Kosaraju-Sharir algorithm is as follows: Let G be a directed graph and S be an empty stack. While S does not contain all vertices. Choose an arbitrary vertex v not in S. Perform a depth-first search starting at v.…
drew moore
  • 31,565
  • 17
  • 75
  • 112
0
votes
1 answer

problems with eulerian cycle in a directed graph

so below is my code for finding if a graph has a eulerian cycle in a directed graph. The code works for several case(the commented lines in my main method works). But it does work for the g1 graph(the uncommented code in my main method) . it says…
user3137376
  • 1,527
  • 2
  • 19
  • 29
-1
votes
1 answer

Kosaraju implementation in C not completely correct

I am trying to implement Kosaraju's algorithm that finds strongly connected components in a directed graph in a linear time but the result is not correct and my implementation probably has a small error. I need help. What my outputs: Strongly…
Node.JS
  • 1,042
  • 6
  • 44
  • 114