class documentation
class MonochromaticGraph(Graph):
Constructor: MonochromaticGraph(graph_formats, graph_order, edge_colors, selected_color, ...)
This class inherits from the Graph class and is used to create monochromatic graphs, i.e.,
k-edge-colored looped complete graphs where all edges (resp. arcs) share the same color or
are all uncolored. The class also allows selecting the initial graph formats in which an
instance should be represented.
| Method | __init__ |
This constructor initializes a monochromatic graph in the specified graph formats. |
Inherited from Graph:
| Class Method | from |
This class method initializes a Graph object in either the adjacency matrix format with color numbers or the adjacency matrix format with binary slices. |
| Class Method | from |
This class method initializes a Graph object in either the bitmask format for the out-neighborhoods or the bitmask format for the in-neighborhoods. |
| Class Method | from |
This class method initializes a Graph object in exactly one of the four possible flattened graph formats. |
| Method | __getitem__ |
This method returns the graph at the given index if this object models a batch of graphs. If this object models a single graph, it raises an IndexError. |
| Property | adjacency |
This property returns the numpy.ndarray of type numpy.uint8 representing the given graph or batch of graphs in the adjacency matrix format with binary slices. |
| Property | adjacency |
This property returns the numpy.ndarray of type numpy.uint8 representing the given graph or batch of graphs in the adjacency matrix format with color numbers. |
| Property | allow |
This property returns a bool indicating whether loops are allowed in the given graph or in each graph in the batch. The value True indicates that loops are allowed. |
| Property | batch |
This property returns None if the object represents a single k-edge-colored looped complete graph. If the object represents a batch of k-edge-colored looped complete graphs of the same order, then this property returns the batch size, i... |
| Property | bitmask |
This property returns the numpy.ndarray of type numpy.uint64 representing the given graph or batch of graphs in the bitmask format for the the in-neighborhoods. |
| Property | bitmask |
This property returns the numpy.ndarray of type numpy.uint64 representing the given graph or batch of graphs in the bitmask format for the out-neighborhoods. |
| Property | edge |
This property returns the number of proper edge colors in the given graph or batch of graphs, i.e., k, as a positive int that is at least 2. |
| Property | flattened |
This property returns the numpy.ndarray of type numpy.uint8 representing the given graph or batch of graphs in the flattened clockwise format with binary slices. |
| Property | flattened |
This property returns the numpy.ndarray of type numpy.uint8 representing the given graph or batch of graphs in the flattened clockwise format with color numbers. |
| Property | flattened |
This property returns the numpy.ndarray of type numpy.uint8 representing the given graph or batch of graphs in the flattened row-major format with binary slices. |
| Property | flattened |
This property returns the numpy.ndarray of type numpy.uint8 representing the given graph or batch of graphs in the flattened row-major format with color numbers. |
| Property | graph |
This property returns the order of the given graph or the common order of all graphs in the batch, as a positive int. |
| Property | is |
This property returns a bool indicating whether the given graph or each graph in the batch is directed. The value True indicates that the graph or graphs are directed. |
| Method | __convert |
This private method performs a direct conversion from the format representation of the given graph or batch of graphs in a selected input format to the format representation of that graph or batch of graphs in a selected output format... |
| Instance Variable | __adjacency |
Either a numpy.ndarray of type numpy.uint8 representing the graph structure in the adjacency matrix format with binary slices, if this format was used during initialization or computed afterwards, or None... |
| Instance Variable | __adjacency |
Either a numpy.ndarray of type numpy.uint8 representing the graph structure in the adjacency matrix format with color numbers, if this format was used during initialization or computed afterwards, or None... |
| Instance Variable | __allow |
A bool indicating whether the graph or each graph in the batch is allowed to have loops. If loops are not allowed, then all loops are removed from the considered looped complete graph or graphs and therefore do not exist. |
| Instance Variable | __batch |
Either None, if the object models a single graph, or a positive int, if the object models a batch of graphs, specifying the batch size, i.e., the number of graphs in the batch. |
| Instance Variable | __bitmask |
Either a numpy.ndarray of type numpy.uint64 representing the graph structure in the bitmask format for the in-neighborhoods, if this format was used during initialization or computed afterwards, or None... |
| Instance Variable | __bitmask |
Either a numpy.ndarray of type numpy.uint64 representing the graph structure in the bitmask format for the out-neighborhoods, if this format was used during initialization or computed afterwards, or None... |
| Instance Variable | __edge |
The number of proper edge colors, i.e., k, given as a positive int that is at least 2. |
| Instance Variable | __flattened |
Either a numpy.ndarray of type numpy.uint8 representing the graph structure in the flattened clockwise format with binary slices, if this format was used during initialization or computed afterwards, or ... |
| Instance Variable | __flattened |
Either a numpy.ndarray of type numpy.uint8 representing the graph structure in the flattened clockwise format with color numbers, if this format was used during initialization or computed afterwards, or ... |
| Instance Variable | __flattened |
Either a numpy.ndarray of type numpy.uint8 representing the graph structure in the flattened row-major format with binary slices, if this format was used during initialization or computed afterwards, or ... |
| Instance Variable | __flattened |
Either a numpy.ndarray of type numpy.uint8 representing the graph structure in the flattened row-major format with color numbers, if this format was used during initialization or computed afterwards, or ... |
| Instance Variable | __graph |
The graph order or the common order of all graphs in the batch, given as a positive int. |
| Instance Variable | __is |
A bool indicating whether the graph or each graph in the batch is a k-edge-colored looped complete directed graph or a k-edge-colored looped complete undirected graph. |
def __init__(self, graph_formats:
set[ GraphFormat], graph_order: int, edge_colors: int = 2, selected_color: int = 0, is_directed: bool = False, allow_loops: bool = False):
ΒΆ
overrides
rlgt.graphs.graph.Graph.__init__This constructor initializes a monochromatic graph in the specified graph formats.
| Parameters | |
graphset[ | A nonempty set of GraphFormat enumeration items that specify the
formats in which the graph should be initialized. |
graphint | The graph order, given as a positive int. |
edgeint | A positive int (at least 2) representing the number of proper edge
colors, i.e., k. The default value is 2. |
selectedint | The color to assign to all edges (resp. arcs), given as a
nonnegative int from 0 to edge_colors. If equal to edge_colors, all edges
(resp. arcs) are uncolored. The default value is 0. |
isbool | A bool that indicates whether the graph is directed (True) or
undirected (False). The default value is False. |
allowbool | A bool that indicates whether loops are allowed in the graph. The
default value is False. |