Advertisement
Guest User

Cut Vertices

a guest
Mar 25th, 2024
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. 1. FUNCTION ComputeSTCutVertices(G, s, t)
  2. 2. // Computes all (s, t) cut vertices in DAG G
  3. 3. TopologicalOrder = TopologicalSort(G)
  4. 4. CutVertices = empty list
  5. 5.
  6. 6. For each vertex v in TopologicalOrder:
  7. 7. isSTCutVertex = true
  8. 8. For each edge u -> w in G:
  9. 9. If u is strictly earlier and w is strictly later than v in ordering
  10. 10. isSTCutVertex = false
  11. 11. Break inner loop
  12. 12. If isSTCutVertex:
  13. 13. CutVertices.append(v)
  14. 14.
  15. 15. Return CutVertices
  16. 16. END FUNCTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement