sort2 Function

private function sort2()

Arguments

None

Return Value integer


Called by

proc~~sort2~~CalledByGraph proc~sort2 sort2 proc~reduce reduce proc~reduce->proc~sort2

Contents

Source Code


Source Code

    INTEGER FUNCTION SORT2()
        ! SORT2 SORTS SIZEG AND STPT INTO DESCENDING ORDER ACCORDING TO
        ! VALUES OF SIZEG. XCC=NUMBER OF ENTRIES IN EACH ARRAY
        INTEGER TEMP
        ! IT IS ASSUMED THAT THE GRAPH HAS AT MOST 50 CONNECTED COMPONENTS.
        !COMMON /CC/ XCC, SIZEG(50), STPT(50)

        SORT2 = 0
        IF (XCC == 0) RETURN
        SORT2 = 1
        IND = XCC
10      ITEST = 0
        IND = IND - 1
        IF (IND < 1) RETURN
        DO 20 I=1,IND
            J = I + 1
            IF (SIZEG(I)>=SIZEG(J)) CYCLE
            ITEST = 1
            TEMP = SIZEG(I)
            SIZEG(I) = SIZEG(J)
            SIZEG(J) = TEMP
            TEMP = STPT(I)
            STPT(I) = STPT(J)
            STPT(J) = TEMP
20      END DO
        IF (ITEST == 1) GO TO 10
        RETURN
    END FUNCTION SORT2