Skip to content

Conversation

pertrai1
Copy link
Contributor

@pertrai1 pertrai1 commented Oct 7, 2023

Open in Gitpod know more

Describe your change:

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

Made a couple changes:

  1. Explicit names for clarification of intent and better align with the names used in Graph and Graph3
  2. printGraph string interpolation for readability
  3. Example usage

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized. (chatgpt assistance)
  • 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}.
Made a couple changes: 1. Explicit names for clarification of intent 2. `printGraph` string interpolation for readability 3. Example usage
// get the list for vertex v and put the
// vertex w denoting edge between v and w
this.AdjList.get(v).push(w)
addEdge(vertex1, vertex2) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

v and w are typical names for vertices. vertex1 and vertex2 is less readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be best to close this out and leave the file with naming as is? There could be better things to focus on with your time. I am game for that if you think all is good right now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not major, but it is a minor change for the worse, IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Thanks for the feedback @appgurueu

graph.addVertex("C");
graph.addEdge("A", "B");
graph.addEdge("A", "C");
graph.printGraph();
Copy link
Collaborator

Choose a reason for hiding this comment

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

No side effects. Don't just put an example here. Put it in a JSDoc @example or in the tests.

@pertrai1 pertrai1 closed this Oct 9, 2023
@pertrai1 pertrai1 deleted the graph2-naming-conventions branch October 9, 2023 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants