Topological sort/Extracted top item: Difference between revisions
Content added Content deleted
(J: bug fix -- include files we depend on which themselves depend on nothing) |
(J: group dependencies by dependency level) |
||
Line 49: | Line 49: | ||
depends=. (+. +./ .*.~)^:_ depends |
depends=. (+. +./ .*.~)^:_ depends |
||
keep=. +./depends (] , #~) names e. targets |
keep=. +./depends (] , #~) names e. targets |
||
names /: |
>names ((<@(;:inv)/.~ /: ~.@]) +/"1)&(keep&#) depends |
||
)</lang> |
)</lang> |
||
Line 58: | Line 58: | ||
# Make sure that things we can depend on are included in our dependency structures |
# Make sure that things we can depend on are included in our dependency structures |
||
# Select these targets, and the things they depend on, once we know what depends on what |
# Select these targets, and the things they depend on, once we know what depends on what |
||
# When ordering names by dependencies |
# When ordering names by dependencies: |
||
## only consider names and dependencies we want to keep |
|||
## group names by how many dependencies they have |
|||
## sort strings of names by how many dependencies they have |
|||
Example: |
Example: |
||
Line 72: | Line 75: | ||
) |
) |
||
'top1' compileOrder dependencies |
|||
extra1 ip1a ipcommon ip2a ip2b ip2c des1b des1a1 des1a2 des1c1 |
|||
extra1 |
|||
des1a des1c |
|||
ip1a |
|||
ip1 |
|||
ipcommon |
|||
ip2 |
|||
ip2a |
|||
des1 |
|||
ip2b |
|||
top1 |
|||
ip2c |
|||
⚫ | |||
des1b |
|||
des1a1 |
|||
des1a2 |
|||
des1c1 |
|||
des1a |
|||
des1c |
|||
ip1 |
|||
ip2 |
|||
des1 |
|||
⚫ | |||
=={{header|Python}}== |
=={{header|Python}}== |