Skip to content

Fix infinite loops in cycle finder. - #2834

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_964969489
Open

Fix infinite loops in cycle finder.#2834
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_964969489

Conversation

@copybara-service

Copy link
Copy Markdown

Fix infinite loops in cycle finder.

This change fixes several infinite loop conditions in cycle finder:

  1. Adds loop detection in GraphBuilder.addSuperclassEdges to prevent infinite loops when type hierarchies have cycles.
  2. Fixes ReferenceGraph.findShortestCycle to terminate if there are no more nodes to visit, returning an empty list.
  3. Fixes CycleFinder.handleStronglyConnectedComponent to skip cycle extraction and remove the root from unused types if findShortestCycle returns an empty list.

This change fixes several infinite loop conditions in cycle finder:
1. Adds loop detection in GraphBuilder.addSuperclassEdges to prevent infinite loops when type hierarchies have cycles.
2. Fixes ReferenceGraph.findShortestCycle to terminate if there are no more nodes to visit, returning an empty list.
3. Fixes CycleFinder.handleStronglyConnectedComponent to skip cycle extraction and remove the root from unused types if findShortestCycle returns an empty list.

PiperOrigin-RevId: 964969489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant