sortdg Subroutine

private subroutine sortdg(stk1, stk2, x1, x2, ndeg)

Arguments

Type IntentOptional AttributesName
integer :: stk1
integer :: stk2
integer :: x1
integer :: x2
integer :: ndeg

Called by

proc~~sortdg~~CalledByGraph proc~sortdg sortdg proc~number number proc~number->proc~sortdg proc~reduce reduce proc~reduce->proc~number

Contents

Source Code


Source Code

    SUBROUTINE SORTDG(STK1, STK2, X1, X2, NDEG)
        ! SORTDG SORTS STK2 BY DEGREE OF THE NODE AND ADDS IT TO THE END
        ! OF STK1 IN ORDER OF LOWEST TO HIGHEST DEGREE.  X1 AND X2 ARE THE
        ! NUMBER OF NODES IN STK1 AND STK2 RESPECTIVELY.
        INTEGER X1, X2, STK1, STK2, TEMP
        ! COMMON /GRA/ N, IDPTH, IDEG
        DIMENSION NDEG(N), STK1(X1+X2), STK2(X2)
        IND = X2
10      ITEST = 0
        IND = IND - 1
        IF (IND < 1) GO TO 30
        DO 20 I=1,IND
            J = I + 1
            ISTK2 = STK2(I)
            JSTK2 = STK2(J)
            IF (NDEG(ISTK2) <= NDEG(JSTK2)) CYCLE
            ITEST = 1
            TEMP = STK2(I)
            STK2(I) = STK2(J)
            STK2(J) = TEMP
20      END DO
        IF (ITEST == 1) GO TO 10
30      DO 40 I=1,X2
            X1 = X1 + 1
            STK1(X1) = STK2(I)
40      END DO
        RETURN
    END SUBROUTINE SORTDG