qgym.generators.graph module
This module contains graph generators for InitialMapping
.
- class qgym.generators.graph.BasicGraphGenerator(interaction_graph_edge_probability=0.5, seed=None)[source]
Bases:
GraphGenerator
BasicGraphGenerator
is a simple graph generation implementation.It uses
fast_gnp_random_graph()
to generate graphs.- __init__(interaction_graph_edge_probability=0.5, seed=None)[source]
Init of the
BasicGraphGenerator
.- Parameters:
interaction_graph_edge_probability (
SupportsFloat
) – Probability to add an edge between two nodes. See the documentation offast_gnp_random_graph()
for more information.seed (
Generator
|SupportsInt
|None
) – Seed to use.
- __repr__()[source]
String representation of the
BasicGraphGenerator
.- Return type:
- class qgym.generators.graph.GraphGenerator[source]
-
Abstract Base Class for graph generation.
All graph generators should inherit from
GraphGenerator
to be compatible with theInitialMapping
environment.- abstract __next__()[source]
Make a new :class:~`networkx.Graph`, representing an interaction graph.
The __next__ method of a
GraphGenerator
should generate a :class:~`networkx.Graph` representation of the interaction graph. To be a valid interaction graph, all nodes should have integer labels starting from 0 and up to the number of nodes minus 1.- Return type:
- abstract set_state_attributes(**kwargs)[source]
Set attributes that the state can receive.
This method is called inside the mapping environment to receive information about the state. The same keywords as for the the init of the
InitialMappingState
are provided.- Return type:
- class qgym.generators.graph.NullGraphGenerator[source]
Bases:
GraphGenerator
Generator class for generating empty
Graphs
.Useful for unit testing.
- __init__()[source]
Init of the
NullGraphGenerator
- __repr__()[source]
String representation of the
NullGraphGenerator
.- Return type: