Skip to content
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

fix: refactor DynamicGraph print method #1060

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Abhinavcode13
Copy link

Fixes: #1009

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev
Copy link
Owner

@Abhinavcode13, the test failures are mostly due to the old graph printing style in tests.

std::unordered_set<size_t> visited;

// Recursive function to print nodes with indentation based on depth.
std::function<void(size_t, int)> printNode = [&](size_t nodeId, int depth) {
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
std::function<void(size_t, int)> printNode = [&](size_t nodeId, int depth) {
auto printNode = [&](size_t nodeId, int depth) {

I believe we can the recursion with the cheaper iteration approach.

Copy link
Author

Choose a reason for hiding this comment

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

Yes

Copy link
Owner

Choose a reason for hiding this comment

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

Co-authored-by: Vassil Vassilev <v.g.vassilev@gmail.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions


// Recursively print all children (nodes connected by edges).
for (size_t destId : m_adjList[nodeId]) {
printNode(destId, depth + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'printNode' declared with deduced type 'auto' cannot appear in its own initializer [clang-diagnostic-error]

            printNode(destId, depth + 1);
            ^

@Abhinavcode13 Abhinavcode13 changed the title Refactor DynamicGraph print method fix: refactor DynamicGraph print method Aug 28, 2024
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

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.

Improve the printing of the DynamicGraph
2 participants