dag_generate_dependency_matrix Subroutine

private subroutine dag_generate_dependency_matrix(me, mat)

Generate the dependency matrix for the DAG.

This is an matrix with elements , such that is true if vertex depends on vertex .

Type Bound

dag

Arguments

Type IntentOptional Attributes Name
class(dag), intent(in) :: me
logical, intent(out), dimension(:,:), allocatable :: mat

dependency matrix


Source Code

    subroutine dag_generate_dependency_matrix(me,mat)

    class(dag),intent(in) :: me
    logical,dimension(:,:),intent(out),allocatable :: mat !! dependency matrix

    integer(ip) :: i !! vertex counter
    integer(ip) :: j !! edge counter

    if (me%n > 0) then

        allocate(mat(me%n,me%n))
        mat = .false.

        do i=1,me%n
            if (allocated(me%vertices(i)%edges)) then
                do j = 1, size(me%vertices(i)%edges)
                    mat(i,me%vertices(i)%edges(j)%ivertex) = .true.
                end do
            end if
        end do

    end if

    end subroutine dag_generate_dependency_matrix