Topological sort: Difference between revisions

m
(adding fortran 77)
Line 656:
''Output'' : IORD(1:NO) is the compile order, and IORD(NO+1:NL) contains unordered libraries.
 
This implementation is not optimal: for each ''level'' of dependency (for example A -> B -> C counts hasas twothree levels), there is a loop through all dependencies in IDEP. It would be possible to optimize a bit, without changing the main idea, by first sorting IDEP according to first column, and using more temporary space, keeping track of where is located data in IDEP for each library (all dependencies of a same library being grouped).
<lang fortran> SUBROUTINE TSORT(NL,ND,IDEP,IORD,IPOS,NO)
IMPLICIT NONE
Anonymous user