Skip to content

Conversation

Rimkomatic
Copy link

Open in Gitpod know more

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Copy link
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

  • Please try to merge this with our existing graph implementations rather than adding yet another one.
  • When is IDS useful? At first glance this looks like a very inefficient way to implement breadth-first search to me.
  • Missing tests and proper docs. Don't include examples as outcommented code, include them as JSDoc @examples or via the tests.

@Rimkomatic
Copy link
Author

Please do not compare this with BFS , it is a modified dfs search ,
IDS is guaranteed to find a solution if one exists, as long as the search space is finite and the branching factor is not extremely high. It's a complete search algorithm, unlike pure depth-first search (DFS), which can get stuck in infinite branches.
Its understandable that you don't wanna marge it , yeah

@Rimkomatic Rimkomatic closed this Oct 8, 2023
@appgurueu
Copy link
Collaborator

IDS is guaranteed to find a solution if one exists

This guarantee is very weak. For a finite graph, any algorithm that eventually visits all nodes will have this property, and the graphs we're dealing with here are exclusively finite.

Please do not compare this with BFS , it is a modified dfs search

What I could discern from the code is:

  • You check all nodes until a certain depth
  • You increase the depth limit by one
  • Rinse and repeat until node is found

This is effectively an inefficient breadth-first search, no? With each iteration of the loop, you check another level.

It's a complete search algorithm, unlike pure depth-first search (DFS), which can get stuck in infinite branches.

How is that relevant here? The in-memory data structures involved here aren't infinite as far as I can tell.

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.

2 participants