add_edge Subroutine

subroutine add_edge(inode, ichild, idist)

add an edge to this node (path to another node with the specified distance)

Arguments

Type IntentOptional Attributes Name
integer(kind=ip), intent(in) :: inode
integer(kind=ip), intent(in) :: ichild
integer(kind=ip), intent(in) :: idist

Called by

proc~~add_edge~2~~CalledByGraph proc~add_edge~2 problem_23::add_edge proc~build_graph problem_23::build_graph proc~build_graph->proc~add_edge~2 proc~build_graph->proc~build_graph proc~go~5 problem_23::go proc~go~5->proc~build_graph program~problem_23 problem_23 program~problem_23->proc~go~5

Source Code

    subroutine add_edge(inode, ichild, idist)
        !! add an edge to this node (path to another node with the specified distance)
        integer(ip),intent(in) :: inode, ichild, idist
        if (.not. allocated(nodes(inode)%inext)) then
            allocate(nodes(inode)%inext(0))
            allocate(nodes(inode)%idist(0))
        end if
        nodes(inode)%inext = [nodes(inode)%inext, ichild]
        nodes(inode)%idist = [nodes(inode)%idist, idist]
    end subroutine add_edge