New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored and Included Tests for TopoSortFromBfsNodeMap #1133
Merged
kodiakhq
merged 2 commits into
guacsec:main
from
nathannaveen:nathan/feat/refactorAndAddedTestsForToposort
Aug 15, 2023
Merged
Refactored and Included Tests for TopoSortFromBfsNodeMap #1133
kodiakhq
merged 2 commits into
guacsec:main
from
nathannaveen:nathan/feat/refactorAndAddedTestsForToposort
Aug 15, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nathannaveen
force-pushed
the
nathan/feat/refactorAndAddedTestsForToposort
branch
3 times, most recently
from
August 9, 2023 19:18
1f0a3dd
to
9407373
Compare
nathannaveen
commented
Aug 9, 2023
nathannaveen
force-pushed
the
nathan/feat/refactorAndAddedTestsForToposort
branch
from
August 9, 2023 19:25
9407373
to
fc6ebca
Compare
@rmetzman Did you want to review this one as well? |
rmetzman
reviewed
Aug 9, 2023
rmetzman
reviewed
Aug 9, 2023
rmetzman
reviewed
Aug 9, 2023
Thank you! LGTM |
pxp928
approved these changes
Aug 10, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
lumjjb
approved these changes
Aug 15, 2023
@nathannaveen rebase will auto merge. |
* Refactored the code for TopoSortFromBfsNodeMap for readability and time complexity purposes. * Included tests for TopoSortFromBfsNodeMap Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
nathannaveen
force-pushed
the
nathan/feat/refactorAndAddedTestsForToposort
branch
from
August 15, 2023 20:39
82511e2
to
a2178b5
Compare
Done, Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the PR
In regards of improving the time complexity here is what I did:
I changed
parentsMap
from amap[string] []string
to amap[string] parent
, withparent
being:So basically now
parentsMap = map[string] map[string] bool
. This so that we don't have to loop through every value inparentsMap
. Doing this change will improve the time complexity by a lot, instead of looping through every value, we will only be doing anO(1)
operation to remove eachid
from the maps.I also added a
map[string] []string
calledchildrensMap
, it is a map of parents to a list of children. This makes it so that we know which children have which parents. We can use this to only loop through the nodes that have a certain parent and not just loop through each and every node.This may be affected by: #1132
PR Checklist
-s
flag togit commit
.make generate
has been runcollectsub
protobuf has been changed,make proto
has been run