Skip to content

Commit

Permalink
Merge pull request #40 from sourceryinstitute/add-num-vertices
Browse files Browse the repository at this point in the history
Add get_num_vertices type-bound procedure
  • Loading branch information
rouson authored Apr 20, 2021
2 parents 8a91e19 + 7511809 commit f953b19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dag_implementation.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@

!*******************************************************************************

module procedure dag_get_num_vertices
num_vertices = size(me%vertices)
end procedure

module procedure dag_get_edges

call assert(ivertex>=lbound(me%vertices,1) .and. ivertex<=ubound(me%vertices,1),"dag_get_edges: index in bounds")
Expand Down
7 changes: 7 additions & 0 deletions src/dag_interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ module dag_interface
procedure,public :: toposort => dag_toposort
procedure,public :: generate_dependency_matrix => dag_generate_dependency_matrix
procedure,public :: save_digraph => dag_save_digraph
procedure,public :: get_num_vertices => dag_get_num_vertices
procedure,public :: get_edges => dag_get_edges
procedure,public :: get_dependencies => dag_get_dependencies

Expand Down Expand Up @@ -192,6 +193,12 @@ module function from_json(me_json) result(me)
type(json_object_t), intent(in) :: me_json
type(dag_t) :: me
end function
!*******************************************************************************
pure module function dag_get_num_vertices(me) result(num_vertices)
implicit none
class(dag_t), intent(in) :: me
integer num_vertices
end function
!*******************************************************************************
pure module function dag_get_edges(me,ivertex) result(edges)
implicit none
Expand Down

0 comments on commit f953b19

Please sign in to comment.