dag_get_dependencies Function

private pure function dag_get_dependencies(me, ivertex) result(dep)

get all the vertices that depend on this vertex.

Type Bound

dag

Arguments

Type IntentOptional Attributes Name
class(dag), intent(in) :: me
integer(kind=ip), intent(in) :: ivertex

Return Value integer(kind=ip), dimension(:), allocatable

the set of all vertices than depend on ivertex


Source Code

    pure function dag_get_dependencies(me,ivertex) result(dep)

    class(dag),intent(in) :: me
    integer(ip),intent(in) :: ivertex
    integer(ip),dimension(:),allocatable :: dep  !! the set of all vertices
                                             !! than depend on `ivertex`

    integer(ip) :: i !! vertex counter

    if (ivertex>0 .and. ivertex <= me%n) then

        ! have to check all the vertices:
        do i=1, me%n
            if (allocated(me%vertices(i)%edges)) then
                if (any(me%vertices(i)%edges%ivertex == ivertex)) then
                    if (allocated(dep)) then
                        dep = [dep, i]  ! auto LHS allocation
                    else
                        dep = [i]       ! auto LHS allocation
                    end if
                end if
            end if
        end do

    end if

    end function dag_get_dependencies