Generate the order of the layers in the network
This module contains the subroutine to generate the order of the layers in the network. The order is generated by depth first search (DFS) on the graph of the network.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(network_type), | intent(inout) | :: | this |
Instance of network |
module subroutine build_vertex_order(this) !! Generate the order of the layers in the network !! !! This module contains the subroutine to generate the order of the layers !! in the network. The order is generated by depth first search (DFS) on the !! graph of the network. implicit none ! Arguments class(network_type), intent(inout) :: this !! Instance of network ! Local variables integer :: i, order_index !! Loop index logical, dimension(this%auto_graph%num_vertices) :: visited !! Array to store whether a vertex has been visited = .false. if(allocated(this%vertex_order)) deallocate(this%vertex_order) allocate(this%vertex_order(this%auto_graph%num_vertices), source=0) order_index = 0 do i = this%auto_graph%num_vertices, 1, -1 if(.not.visited(i)) call this%dfs( & i, visited, this%vertex_order, order_index & ) end do end subroutine build_vertex_order