DAG Module.
a vertex of a directed acyclic graph (DAG)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private, | dimension(:), allocatable | :: | edges |
these are the vertices that this vertex depends on |
||
| integer, | private | :: | ivertex | = | 0 |
vertex number |
|
| logical, | private | :: | checking | = | .false. |
used for toposort |
|
| logical, | private | :: | marked | = | .false. |
used for toposort |
|
| character(len=:), | private, | allocatable | :: | label |
used for diagraph |
||
| character(len=:), | private, | allocatable | :: | attributes |
used for diagraph |
| generic, public :: set_edges => set_edge_vector, add_edge | |
| procedure, public :: set_edge_vector | |
| procedure, public :: add_edge |
a directed acyclic graph (DAG)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | n | = | 0 |
number of |
|
| type(vertex), | private, | dimension(:), allocatable | :: | vertices |
the vertices in the DAG. |
| procedure, public :: set_vertices => dag_set_vertices | |
| procedure, public :: set_edges => dag_set_edges | |
| procedure, public :: set_vertex_info => dag_set_vertex_info | |
| procedure, public :: toposort => dag_toposort | |
| procedure, public :: generate_digraph => dag_generate_digraph | |
| procedure, public :: generate_dependency_matrix => dag_generate_dependency_matrix | |
| procedure, public :: save_digraph => dag_save_digraph | |
| procedure, public :: get_edges => dag_get_edges | |
| procedure, public :: get_dependencies => dag_get_dependencies | |
| procedure, public :: destroy => dag_destroy |
get the edges for the vertex (all the the vertices that this vertex depends on).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(in) | :: | me | |||
| integer, | intent(in) | :: | ivertex |
get all the vertices that depend on this vertex.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(in) | :: | me | |||
| integer, | intent(in) | :: | ivertex |
the set of all vertices
than depend on ivertex
Generate a Graphviz digraph structure for the DAG.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(in) | :: | me | |||
| character(len=*), | intent(in), | optional | :: | rankdir |
right to left orientation (e.g. 'RL') |
|
| integer, | intent(in), | optional | :: | dpi |
resolution (e.g. 300) |
Integer to allocatable string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i |
specify the edge indices for this vertex
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vertex), | intent(inout) | :: | me | |||
| integer, | intent(in), | dimension(:) | :: | edges |
add an edge index for this vertex
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vertex), | intent(inout) | :: | me | |||
| integer, | intent(in) | :: | edge |
set the number of vertices in the dag
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(inout) | :: | me | |||
| integer, | intent(in) | :: | nvertices |
number of vertices |
set info about a vertex in a dag.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(inout) | :: | me | |||
| integer, | intent(in) | :: | ivertex |
vertex number |
||
| character(len=*), | intent(in), | optional | :: | label |
if a label is not set, then the integer vertex number is used. |
|
| character(len=*), | intent(in), | optional | :: | attributes |
other attributes when saving as a diagraph. |
set the edges for a vertex in a dag
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(inout) | :: | me | |||
| integer, | intent(in) | :: | ivertex |
vertex number |
||
| integer, | intent(in), | dimension(:) | :: | edges |
Main toposort routine
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(inout) | :: | me | |||
| integer, | intent(out), | dimension(:), allocatable | :: | order |
the toposort order |
|
| integer, | intent(out) | :: | istat |
Status flag: |
Generate the dependency matrix for the DAG.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(in) | :: | me | |||
| logical, | intent(out), | dimension(:,:), allocatable | :: | mat |
dependency matrix |
Generate a Graphviz digraph structure for the DAG and write it to a file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dag), | intent(in) | :: | me | |||
| character(len=*), | intent(in), | optional | :: | filename |
file name for diagraph |
|
| character(len=*), | intent(in), | optional | :: | rankdir |
right to left orientation (e.g. 'RL') |
|
| integer, | intent(in), | optional | :: | dpi |
resolution (e.g. 300) |