Skip to content

Conversation

@123FLO321
Copy link

This pull request adds new constraints and customization options to the Graph class's path() method, enhancing its flexibility for pathfinding. It introduces support for limiting the maximum cost and maximum number of nodes in a path, as well as a callback to control which edges are allowed during path expansion.
Tests for new cases are added.

closes #46

Also includes types (from @types/node-dijkstra) with modifications untill #45 is merged.

@123FLO321 123FLO321 changed the title Br 46 feat: enhance pathfinding options with maxCost, maxNodes, and allowedCallback Nov 4, 2025
Copy link
Owner

@albertorestifo albertorestifo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! :)

Left a couple of notes, let me know what you think.

@albertorestifo
Copy link
Owner

Ah also I see there are some errors from Prettier, can you please run it on the code? Thanks!

@123FLO321
Copy link
Author

@albertorestifo I fixed the lint issues (and also moved lint from the test script and explicitly run it in the workflow).
And also implemented the requested test.


// Add the starting point to the frontier, it will be the first node visited
frontier.set(start, 0);
depth.set(start, 1);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should depth start at 0 or 1 for the root node?

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.

Max Cost option

2 participants