Set the graph structure of the input data
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(duvenaud_msgpass_layer_type), | intent(inout) | :: | this |
Instance of the layer |
||
| type(graph_type), | intent(in), | dimension(:) | :: | graph |
Graph structure of input data |
subroutine set_graph_duvenaud(this, graph) !! Set the graph structure of the input data implicit none ! Arguments class(duvenaud_msgpass_layer_type), intent(inout) :: this !! Instance of the layer type(graph_type), dimension(:), intent(in) :: graph !! Graph structure of input data ! Local variables integer :: s, t !! Loop indices if(allocated(this%graph))then if(size(this%graph).ne.size(graph))then deallocate(this%graph) allocate(this%graph(size(graph))) end if else allocate(this%graph(size(graph))) end if do s = 1, size(graph) this%graph(s)%adj_ia = graph(s)%adj_ia this%graph(s)%adj_ja = graph(s)%adj_ja this%graph(s)%edge_weights = graph(s)%edge_weights this%graph(s)%num_edges = graph(s)%num_edges this%graph(s)%num_vertices = graph(s)%num_vertices if(any(this%graph(s)%adj_ja(1,:).gt.this%graph(s)%num_vertices))then write(*,*) "Error: graph adjacency matrix has indices greater than & &the number of vertices", s, & this%graph(s)%num_vertices write(*,*) "Adjacency matrix indices: ", this%graph(s)%adj_ja stop end if end do end subroutine set_graph_duvenaud