This Python module defines several factory functions for constructing graph generator functions. These generators implement various mechanisms for producing batches of fully colored k-edge-colored looped complete graphs of a specified batch size.
| Function | create |
This function creates a GraphGenerator function that outputs batches of fully colored k-edge-colored looped complete graphs, where each graph in the batch is assigned to be equal to either one of two user-provided graphs according to a given probability... |
| Function | create |
This function creates a GraphGenerator function that outputs batches of fully colored k-edge-colored looped complete graphs where all graphs are initially equal to a provided graph, and then each edge (resp... |
| Function | create |
This function creates a GraphGenerator function that outputs batches of fully colored k-edge-colored looped complete graphs, where all the graphs are identical to a user-provided fixed_graph. The user can also configure the starting graph format of the output batch. |
| Function | create |
This function creates a GraphGenerator function that outputs batches of fully colored k-edge-colored looped complete graphs generated randomly. Each edge (resp. arc) in each graph is assigned a color independently according to a specified discrete probability distribution... |
| Type Alias | |
This is a type alias for representing graph generator functions that accept a single int argument specifying the batch size and return a Graph object representing a batch of fully colored k-edge-colored looped complete graphs of that size... |
Graph, second_graph: Graph, second_graph_probability: float, graph_format: GraphFormat = GraphFormat.FLATTENED_ROW_MAJOR_COLORS, random_generator: np.random.Generator | None = None) -> GraphGenerator:
¶
This function creates a GraphGenerator function that outputs batches of fully colored
k-edge-colored looped complete graphs, where each graph in the batch is assigned to be equal
to either one of two user-provided graphs according to a given probability. The two graphs must
have the same number of edge colors, the same order, and the same type (both directed or both
undirected, and both either allow loops or not). The user can also configure the starting graph
format for the output batch.
| Parameters | |
firstGraph | A fully colored Graph object representing the first graph that the output
batch graphs could be equal to. |
secondGraph | A fully colored Graph object representing the second graph that the
output batch graphs could be equal to. |
secondfloat | A float in the interval [0, 1] specifying the probability
that a graph in the output batch is equal to second_graph. |
graphGraphFormat | An item of the GraphFormat enumeration specifying the format in which
the output batch of graphs should be initialized. The default value is
GraphFormat.FLATTENED_ROW_MAJOR_COLORS, i.e., the flattened row-major format with color
numbers. |
randomnp.random.Generator | None | Either None, or a numpy.random.Generator used for probabilistic
decisions. If None, a default generator will be used. The default value is None. |
| Returns | |
GraphGenerator | The created GraphGenerator function. |
Graph, edge_perturbation_probability: float, color_selection_probabilities: np.ndarray | float | None = None, flattened_ordering: FlattenedOrdering = FlattenedOrdering.ROW_MAJOR, random_generator: np.random.Generator | None = None) -> GraphGenerator:
¶
This function creates a GraphGenerator function that outputs batches of fully colored
k-edge-colored looped complete graphs where all graphs are initially equal to a provided
graph, and then each edge (resp. arc) may be perturbed with a given probability. The edge
(resp. arc) perturbation consists of recoloring it with a randomly chosen color between 0 and
k - 1 according to a discrete probability distribution. Here, k is determined from the
provided initial graph. The output batch is initialized in one of the two flattened formats
with color numbers, which can be selected via the flattened_ordering argument.
| Parameters | |
initialGraph | A fully colored Graph object representing the base graph that all
graphs in the output batch are initialized to before edge (resp. arc) perturbations. |
edgefloat | A float from the interval [0, 1] specifying the
probability that any given edge (resp. arc) is subjected to a perturbation. |
colornp.ndarray | float | None | This argument defines how the new color for a perturbed edge (resp. arc) is chosen. Three options are allowed:
|
flattenedFlattenedOrdering | An item of the FlattenedOrdering enumeration specifying whether
the output batch should be initialized in the flattened row-major or flattened clockwise
format with color numbers. The default value is FlattenedOrdering.ROW_MAJOR. |
randomnp.random.Generator | None | Either None, or a numpy.random.Generator used for probabilistic
decisions. If None, a default generator will be used. The default value is None. |
| Returns | |
GraphGenerator | The created GraphGenerator function. |
Graph, graph_format: GraphFormat = GraphFormat.FLATTENED_ROW_MAJOR_COLORS) -> GraphGenerator:
¶
This function creates a GraphGenerator function that outputs batches of fully colored
k-edge-colored looped complete graphs, where all the graphs are identical to a user-provided
fixed_graph. The user can also configure the starting graph format of the output batch.
| Parameters | |
fixedGraph | A fully colored Graph object that all graphs in the output batch should
be identical to. |
graphGraphFormat | An item of the GraphFormat enumeration specifying the format in which
the output batch of graphs should be initialized. The default value is
GraphFormat.FLATTENED_ROW_MAJOR_COLORS, i.e., the flattened row-major format with color
numbers. |
| Returns | |
GraphGenerator | The created GraphGenerator function. |
int, color_selection_probabilities: np.ndarray | float | None = None, flattened_ordering: FlattenedOrdering = FlattenedOrdering.ROW_MAJOR, edge_colors: int = 2, is_directed: bool = False, allow_loops: bool = False, random_generator: np.random.Generator | None = None) -> GraphGenerator:
¶
This function creates a GraphGenerator function that outputs batches of fully colored
k-edge-colored looped complete graphs generated randomly. Each edge (resp. arc) in each graph
is assigned a color independently according to a specified discrete probability distribution.
The user can configure the graph order, number of proper edge colors, directionality, and loop
allowance. The output batch is initialized in one of the two flattened formats with color
numbers, which can be selected via the flattened_ordering argument.
| Parameters | |
graphint | A positive int specifying the order of the graphs to be generated. |
colornp.ndarray | float | None | This argument specifies the probability distribution for assigning a color to each edge (resp. arc). Three options are allowed:
|
flattenedFlattenedOrdering | An item of the FlattenedOrdering enumeration specifying whether
the output batch should be initialized in the flattened row-major or flattened clockwise
format with color numbers. The default value is FlattenedOrdering.ROW_MAJOR. |
edgeint | A positive int (not below 2) specifying the number of proper edge colors
in the graphs to be generated. The default value is 2. |
isbool | A bool indicating whether the graphs to be generated are directed. The
default value is False. |
allowbool | A bool indicating whether loops are allowed in the graphs to be
generated. The default value is False. |
randomnp.random.Generator | None | Either None, or a numpy.random.Generator used for probabilistic
decisions. If None, a default generator will be used. The default value is None. |
| Returns | |
GraphGenerator | The created GraphGenerator function. |
This is a type alias for representing graph generator functions that accept a single int argument
specifying the batch size and return a Graph object representing a batch of fully colored
k-edge-colored looped complete graphs of that size. The graphs in the batch are generated using
an internal mechanism defined by the generator function, and the generation process need not be
deterministic.
| Value |
|