-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: add page #2278
tsort: add page #2278
Conversation
The build for this PR has failed with the following error(s):
Please fix the error(s) and push again. |
pages/common/tsort.md
Outdated
|
||
> Perform a topological sort. | ||
|
||
- Perform a topological sort consistent with a partial sort per line of input broken up into elements separated by blanks: |
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.
Erm I'm confused! What does this do? That's a lot of words jumbled up in that sentence.
Perhaps we could add some additional clarity in a second line of the command description too - maybe something like this?:
> In other words ......
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.
Yeah, that was my worry when I wrote this.
Essentially, it takes a file where each line is some list of "dependencies":
a b c
d
e f
b c d e
which can be read as:
- a is before b which is before c
- e is before f
- b is before c which is before d which is before e
and produces a topological sort of it:
a
b
c
d
e
f
So the gist of that sentence is:
- Produces a topological sort of a file which has some number of lines
- Each line of the file gives a partial ordering of elements for the sort
- Each element is separated by a space
I'm not sure how wordy of an explanation you guys allow to expand on that singular sentence.
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.
Ah, I see. What kind of use-cases are there for this kind of thing? Perhaps we could use one to relate the idea better.
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.
The use case would be to see the ordering of dependencies within a directed acyclic graph (a common example is function calls within a program).
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.
We can condense it to - Perform a topological sort consistent with a partial sort per line of input separated by blanks:
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.
Ah, ok! Perhaps we could add a 2nd description line saying A common use is on function calls in a program.
?
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.
Thanks, @MasterOdin 😺
A command from the list in #2213
The page (if new), does not already exist in the repo.
The page (if new), has been added to the correct platform folder:
common/
if it's common to all platforms,linux/
if it's Linux-specific, and so on.The page has 8 or fewer examples.
The PR is appropriately titled:
<command name>: add page
for new pages, or<command name>: <description of changes>
for pages being edited.The page follows the contributing guidelines.