class GraphFormat(Enum):
This enumeration encapsulates the concept of a format used to represent a k-edge-colored looped complete graph. Each graph is represented as a quintuple (edge_colors, is_directed, allow_loops, graph_format, format_representation), where:
- edge_colors is the number of proper edge colors, i.e., k, which is at least 2.
- is_directed is a boolean that indicates whether the graph is a k-edge-colored looped complete directed graph or a k-edge-colored looped complete undirected graph.
- allow_loops is a boolean that indicates whether the graph is allowed to have loops. If loops are not allowed, then all loops are removed from the graph and they simply do not exist.
- graph_format is an item of this enumeration that specifies the format used to represent the graph structure.
- format_representation is a
numpy.ndarraythat encodes the structure of the graph in the chosen format.
The enumeration provides support for the following eight graph formats:
- the bitmask format for the out-neighborhoods;
- the bitmask format for the in-neighborhoods;
- the adjacency matrix format with color numbers;
- the adjacency matrix format with binary slices;
- the flattened row-major format with color numbers;
- the flattened row-major format with binary slices;
- the flattened clockwise format with color numbers; and
- the flattened clockwise format with binary slices.
All formats with color numbers require k ≤ 256. The two bitmask formats require that the graph order is at most 64.
| Note | |
| If the graph is undirected, the bitmask formats for the out- and in-neighborhoods are identical. Also, for undirected graphs, the flattened clockwise format can be interpreted as the flattened column-major format of the upper-triangular part of the adjacency matrix, with or without the diagonal depending on whether loops are allowed. |
| Constant | ADJACENCY |
The adjacency matrix format with binary slices. When this format is used, the graph is represented by a binary numpy.ndarray tensor a of type numpy.uint8 with shape (k, n, n), where n is the graph order... |
| Constant | ADJACENCY |
The adjacency matrix format with color numbers. When this format is used, the graph is represented by a numpy.ndarray square matrix a of type numpy.uint8 with n rows and n columns, where n is the graph order... |
| Constant | BITMASK |
The bitmask format for the in-neighborhoods. When this format is used, the graph is represented by a numpy.ndarray matrix a of type numpy.uint64 with k rows and n columns, where n is the graph order. Each entry ... |
| Constant | BITMASK |
The bitmask format for the out-neighborhoods. When this format is used, the graph is represented by a numpy.ndarray matrix a of type numpy.uint64 with k rows and n columns, where n is the graph order. ... |
| Constant | FLATTENED |
The flattened clockwise format with binary slices. When this format is used, the graph is represented by a binary numpy.ndarray matrix of type numpy.uint8. Each row indicates which entries of the flattened clockwise format with color numbers are equal to 0, 1, …, ... |
| Constant | FLATTENED |
The flattened clockwise format with color numbers. When this format is used, the adjacency matrix entries are arranged in clockwise layer order: (0, 0), (0, 1), (1, 1), (1, 0), (0, 2), (1, 2), (2, 2), (2, 1), (2, 0), …... |
| Constant | FLATTENED |
The flattened row-major format with binary slices. When this format is used, the graph is represented by a binary numpy.ndarray matrix of type numpy.uint8. Each row indicates which entries of the flattened row-major format with color numbers are equal to 0, 1, …, ... |
| Constant | FLATTENED |
The flattened row-major format with color numbers. When this format is used, the adjacency matrix entries are arranged in row-major order. For directed graphs without loops, the diagonal entries are skipped... |
The adjacency matrix format with binary slices. When this format
is used, the graph is represented by a binary numpy.ndarray tensor a of type
numpy.uint8 with shape (k, n, n), where n is the graph order. Each entry
a[i, j, h] indicates whether the edge (or arc) from vertex j to vertex h has color
i. If loops are not allowed, all diagonal entries a[i, j, j] are zero. For fully
colored graphs, the first slice (corresponding to color 0) can be omitted; this variant is
called the reduced adjacency matrix format with binary slices.
| Value |
|
The adjacency matrix format with color numbers. When this format
is used, the graph is represented by a numpy.ndarray square matrix a of type
numpy.uint8 with n rows and n columns, where n is the graph order. Each entry
a[i, j] stores the color of the edge (or arc) from vertex i to vertex j. Uncolored
edges (or arcs) are represented by the value k. If loops are not allowed, all diagonal
entries are zero.
| Value |
|
The bitmask format for the in-neighborhoods. When this format is used, the
graph is represented by a numpy.ndarray matrix a of type numpy.uint64 with k rows
and n columns, where n is the graph order. Each entry a[i, j] is a nonnegative
integer whose h-th bit indicates whether the edge (or arc) from vertex h to vertex j
has color i. If loops are not allowed, the j-th bit of a[i, j] is zero. For fully
colored graphs, the first row (corresponding to color 0) can be omitted; this variant is
called the reduced bitmask format for the in-neighborhoods.
| Value |
|
The bitmask format for the out-neighborhoods. When this format is used, the
graph is represented by a numpy.ndarray matrix a of type numpy.uint64 with k rows
and n columns, where n is the graph order. Each entry a[i, j] is a nonnegative
integer whose h-th bit indicates whether the edge (or arc) from vertex j to vertex h
has color i. If loops are not allowed, the j-th bit of a[i, j] is zero. For fully
colored graphs, the first row (corresponding to color 0) can be omitted; this variant is
called the reduced bitmask format for the out-neighborhoods.
| Value |
|
The flattened clockwise format with binary slices. When this
format is used, the graph is represented by a binary numpy.ndarray matrix of type
numpy.uint8. Each row indicates which entries of the flattened clockwise format with
color numbers are equal to 0, 1, …, k - 1, respectively. For fully colored graphs, the
first row (corresponding to color 0) can be omitted; this variant is called the reduced
flattened clockwise format with binary slices.
| Value |
|
The flattened clockwise format with color numbers. When this
format is used, the adjacency matrix entries are arranged in clockwise layer order: (0, 0),
(0, 1), (1, 1), (1, 0), (0, 2), (1, 2), (2, 2), (2, 1), (2, 0), …. For directed graphs
without loops, diagonal entries are skipped. For undirected graphs, only the
upper-triangular entries are arranged, with or without the diagonal depending on whether
loops are allowed. The arranged entries form a numpy.ndarray of type numpy.uint8; its
length is called the flattened length.
| Value |
|
The flattened row-major format with binary slices. When this
format is used, the graph is represented by a binary numpy.ndarray matrix of type
numpy.uint8. Each row indicates which entries of the flattened row-major format with
color numbers are equal to 0, 1, …, k - 1, respectively. For fully colored graphs, the
first row (corresponding to color 0) can be omitted; this variant is called the reduced
flattened row-major format with binary slices.
| Value |
|
The flattened row-major format with color numbers. When this
format is used, the adjacency matrix entries are arranged in row-major order. For directed
graphs without loops, the diagonal entries are skipped. For undirected graphs, only the
upper-triangular entries are used, with or without the diagonal depending on whether loops
are allowed. The arranged entries form a numpy.ndarray of type numpy.uint8; its length
is called the flattened length.
| Value |
|