remove an edge index from this vertex
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(vertex), | intent(inout) | :: | me | |||
integer(kind=ip), | intent(in) | :: | e |
subroutine remove_edge(me,e) class(vertex),intent(inout) :: me integer(ip),intent(in) :: e integer(ip),dimension(1) :: idx type(edge),dimension(:),allocatable :: tmp if (allocated(me%edges)) then idx = findloc(me%edges%ivertex, e) if (idx(1)>0) then ! the edge is in the list associate (i => idx(1), n => size(me%edges)) if (n==1) then deallocate(me%edges) ! it's the only one there else allocate(tmp(n-1)) if (i>1) tmp(1:i-1) = me%edges(1:i-1) if (i<n) tmp(i:n-1) = me%edges(i+1:n) call move_alloc(tmp,me%edges) end if end associate end if end if end subroutine remove_edge