Destroy the dag.
dag
subroutine dag_destroy(me) class(dag),intent(inout) :: me me%n = 0 if (allocated(me%vertices)) deallocate(me%vertices) end subroutine dag_destroy