Defines an undirected multigraph. Multiple edges between the same pair of vertices, as well as self-loops, are permitted.
Adds an edge to the graph.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(inout) | :: | this |
The graph object. |
||
| integer(kind=int32), | intent(in) | :: | v1 |
The index of the first vertex. |
||
| integer(kind=int32), | intent(in) | :: | v2 |
The index of the second vertex. |
Constructs a spanning tree of the graph by means of a breadth-first traversal.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(in) | :: | this |
The graph object. |
||
| integer(kind=int32), | intent(in), | optional | :: | root |
The index of the vertex from which to start the traversal. If not supplied, the first vertex is used. |
The resulting spanning_tree object.
Determines the set of independent loops within the graph. The number of loops is the cyclomatic number of the graph.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(in) | :: | this |
The graph object. |
||
| type(spanning_tree), | intent(in) | :: | tree |
A spanning tree of this graph. |
An array of the independent loops.
Gets the indices of all edges connected to the requested vertex.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(in) | :: | this |
The graph object. |
||
| integer(kind=int32), | intent(in) | :: | v |
The index of the vertex of interest. |
An array containing the indices of the connected edges.
Gets the requested edge.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(in) | :: | this |
The graph object. |
||
| integer(kind=int32), | intent(in) | :: | i |
The index of the edge to retrieve (1 = first edge). |
The requested edge.
Gets the number of edges in the graph.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(in) | :: | this |
The graph object. |
The edge count.
Gets the number of independent loops in the graph assuming the graph is connected. The value is the cyclomatic number .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(in) | :: | this |
The graph object. |
The number of independent loops.
Gets the number of vertices in the graph.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(in) | :: | this |
The graph object. |
The vertex count.
Initializes the graph with the requested number of vertices and no edges.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(graph), | intent(inout) | :: | this |
The graph object. |
||
| integer(kind=int32), | intent(in) | :: | nvertices |
The number of vertices in the graph. This value must be at least one. |
||
| integer(kind=int32), | intent(in), | optional | :: | ncapacity |
An optional estimate of the number of edges the graph will contain. This value is used only to size the initial storage. |