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

tsort: allow independent nodes #761

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Oct 16, 2024

  • When a node refers to itself in a pair it means the node exists but does not depend on anything
  • Previously, this input would result in a "cycle" error
  • In my test file, allow node 'd' to be added to hash %npred with predecessor count of zero, so it then appears in list @list
  • The inner "foreach" loop does not execute for node 'd' because it has no dependency; it has no need for an entry in hash %succ
%perl cat in.tsort2
a b
b
  c
d d
%perl tsort.old in.tsort2
a
b
c
tsort.old: cycle detected
%perl tsort in.tsort2 # patched
a
b
c
d
%perl cat in.tsort3
a a
%perl tsort in.tsort3 # output agrees with GNU tsort
a

* When a node refers to itself in a pair it means the node exists but does not depend on anything
* Previously, this input would result in a "cycle" error
* In test file, allow node 'd' to be added to npred-hash with a predecessor count of zero, so it can appear in list-list
* The inner "foreach" loop does not execute for node 'd' because it has no dependency; it has no need for an entry in succ-hash

%perl cat in.tsort2
a b
b
  c
d d
%perl tsort.old in.tsort2
a
b
c
tsort.old: cycle detected
%perl tsort in.tsort2
a
b
c
d
%perl cat in.tsort3
a a
%perl tsort in.tsort3
a
@github-actions github-actions bot added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: tsort The sort program labels Oct 16, 2024
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:45 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing October 16, 2024 00:46 — with GitHub Actions Inactive
@coveralls
Copy link

coveralls commented Oct 16, 2024

Pull Request Test Coverage Report for Build 11356756634

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 73.805%

Totals Coverage Status
Change from base Build 11349099383: 0.0%
Covered Lines: 355
Relevant Lines: 481

💛 - Coveralls

@briandfoy briandfoy merged commit 11555c6 into briandfoy:master Oct 16, 2024
23 checks passed
@briandfoy
Copy link
Owner

changes: allow nodes to refer to themselves (has no dependency). This previously created a cycle error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: low get to this whenever Program: tsort The sort program Type: enhancement improve a feature that already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants