Skip to content

fix: resolve infinite loop in path search algorithm#610

Open
Waleed-Ahmad-dev wants to merge 1 commit intop2r3:masterfrom
Waleed-Ahmad-dev:fix-issue-605
Open

fix: resolve infinite loop in path search algorithm#610
Waleed-Ahmad-dev wants to merge 1 commit intop2r3:masterfrom
Waleed-Ahmad-dev:fix-issue-605

Conversation

@Waleed-Ahmad-dev
Copy link
Copy Markdown

What does this PR do?

This PR fixes a bug where the graph traversal algorithm gets caught in an infinite loop during complex format conversions (like pptx to pdf via pandoc).

Fixes #605

Why is it needed?

Because pandoc registers a massive number of input/output combinations (creating over 4,000 edges), the pathfinding algorithm was experiencing an exponential path explosion. The custom visitedBorder logic was failing to properly prune redundant paths, causing the browser/app to hang indefinitely.

How was it fixed?

  • Replaced the global visited array and visitedBorder logic with a minCosts Map.
  • Implemented standard Dijkstra pruning: the algorithm now records the lowest cost to reach any specific format node.
  • If a newly discovered path to a node costs more than or equal to a previously found path, it immediately discards it, preventing infinite loops and drastically speeding up the search.
  • Removed the now-obsolete visitedBorder property from the QueueNode interface.

How was it tested?

  • Tested locally by attempting a conversion from pptx to pdf.
  • Verified that the algorithm now resolves the route almost instantly without hanging or crashing the app.

* Replace visited array with minCosts map to prune redundant paths
* Remove flawed visitedBorder property from QueueNode
* Improve performance by skipping nodes with higher or equal costs
* Prevent exponential path explosion during complex conversions like PPTX to PDF

Fixes #	605
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PPTX to PDF

1 participant