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

stdlib: Fix preorder and postorder traversals in digraph_utils #9171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucioleKi
Copy link
Contributor

The previous digraph_utils:preorder/1 and digraph_utils:postorder/1 did not start the traversal from root nodes. This fix makes both traversals only start or restart from a root node in one of the components, or an arbitrary node if no root node can be visited. Since in the previous version, the search can start and restart from arbitrary nodes, this fix should not break backwards compatibility.

It is worth noting that the digraph does not have a notion of a left or right subtree. The result of both traversals may not be the same after relabelling vertices.

@lucioleKi lucioleKi added the team:VM Assigned to OTP team VM label Dec 10, 2024
@lucioleKi lucioleKi requested review from bjorng and jhogberg December 10, 2024 10:45
@lucioleKi lucioleKi self-assigned this Dec 10, 2024
@lucioleKi lucioleKi linked an issue Dec 10, 2024 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Dec 10, 2024

CT Test Results

    2 files     96 suites   1h 7m 56s ⏱️
2 173 tests 2 124 ✅ 48 💤 1 ❌
2 536 runs  2 485 ✅ 50 💤 1 ❌

For more details on these failures, see this check.

Results for commit f1f456c.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@lucioleKi lucioleKi added the testing currently being tested, tag is used by OTP internal CI label Dec 10, 2024
lib/stdlib/src/digraph_utils.erl Outdated Show resolved Hide resolved
lib/stdlib/src/digraph_utils.erl Outdated Show resolved Hide resolved
lib/stdlib/src/digraph_utils.erl Outdated Show resolved Hide resolved
lib/stdlib/test/digraph_utils_SUITE.erl Show resolved Hide resolved
The previous `digraph_utils:preorder/1` and `digraph_utils:postorder/1`
did not start the traversal from root nodes. This fix makes both
traversals only start or restart from a root node in one of the
components, or an arbitrary node if no root node can be visited.
Since in the previous version, the search can start and restart from
arbitrary nodes, this fix should not break backwards compatibility.

It is worth noting that the digraph does not have a notion of a left or
right subtree. The result of both traversals may not be the same after
relabelling vertices.
@lucioleKi lucioleKi force-pushed the isabell/stdlib/digraph_traversals branch from 604cab1 to f1f456c Compare December 10, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

digraph preorder and postorder traversals return wrong results
2 participants