Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Source Code
function find_smallest_available_color(v,graph,colors)result(color_id)implicit noneinteger(int32)::color_idinteger(int32),intent(in)::vclass(type_crs_adjacency_element),intent(in)::graphinteger(int32),intent(in)::colors(:)logical,allocatable::forbidden_colors(:)integer(int32)::neighbor_color,max_possible_colors,iinteger(int32),allocatable::neighbors(:)integer(int32)::neighbor_idmax_possible_colors=graph%get_degree(v)+1call allocate_array(forbidden_colors,length=max_possible_colors)forbidden_colors=.false.! ゲッターで隣接要素リストを取得し、使用済み色をマークneighbors=graph%get_neighbors(v)do i=1,size(neighbors)neighbor_id=neighbors(i)neighbor_color=colors(neighbor_id)if(neighbor_color>0.and.neighbor_color<=max_possible_colors)thenforbidden_colors(neighbor_color)=.true.end if end do call deallocate_array(neighbors)! マークされていない最小の色を見つけるcolor_id=1do while(color_id<=max_possible_colors)if(.not.forbidden_colors(color_id))then exit end ifcolor_id=color_id+1end do call deallocate_array(forbidden_colors)end function find_smallest_available_color