Skip to content

feat: support cyclic graph #86

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

Merged
merged 1 commit into from
Mar 11, 2021
Merged

feat: support cyclic graph #86

merged 1 commit into from
Mar 11, 2021

Conversation

admons
Copy link
Contributor

@admons admons commented Mar 11, 2021

  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

It allows converting a cyclic graph into an optimized pruned dep-tree

For example, it will take the following DepGraph
image

And convert it into the following DepTree
image

The difference between this PR and #48 is the use of memoization for creating an optimized tree instead of duplicating all cyclic nodes

@admons admons requested a review from darscan March 11, 2021 09:08
@admons admons requested a review from a team as a code owner March 11, 2021 09:08
@admons admons force-pushed the feat/support-cyclic-graph5 branch from 0a0d7c7 to 5cb6ff4 Compare March 11, 2021 11:42
nodeId: NodeId,
allCyclesTheNodeIsPartOf: Cycle[],
): PartitionedCycles {
const cyclesStartWithThisNode = allCyclesTheNodeIsPartOf.filter(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

change to for of

Copy link
Contributor

@darscan darscan left a comment

Choose a reason for hiding this comment

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

Absolutely EPIC! Approving, but please fix those 2 minor issues as discussed

@darscan darscan mentioned this pull request Mar 11, 2021
3 tasks
@admons admons force-pushed the feat/support-cyclic-graph5 branch from 5cb6ff4 to d1a2d07 Compare March 11, 2021 14:09
This pr will add support for converting a cyclic graph into a tree
Image example: convert `cyclic-complex-dep-graph.png` into `cyclic-complex-dep-graph-expected-optimized-tree.png`
@admons admons force-pushed the feat/support-cyclic-graph5 branch from d1a2d07 to 5705237 Compare March 11, 2021 14:12
@admons admons merged commit 3147e03 into master Mar 11, 2021
@admons admons deleted the feat/support-cyclic-graph5 branch March 11, 2021 14:16
@snyksec
Copy link

snyksec commented Mar 11, 2021

🎉 This PR is included in version 1.27.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants