set_graph_msgpass Module Subroutine

module subroutine set_graph_msgpass(this, graph)

Set the graph structure of the input data

Arguments

Type IntentOptional Attributes Name
class(msgpass_layer_type), intent(inout) :: this

Instance of the layer

type(graph_type), intent(in), dimension(:) :: graph

Graph structure of input data


Source Code

  module subroutine set_graph_msgpass(this, graph)
    !! Set the graph structure of the input data
    implicit none

    ! Arguments
    class(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
    !! 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
    end do

  end subroutine set_graph_msgpass