graphenv.vertex.Vertex
- class Vertex[source]
Bases:
Generic
[graphenv.vertex.V
]Abstract class defining a vertex in a graph. To implement a graph using this class, subclass Vertex and implement the abstract methods below.
- Parameters
Generic (V) – The implementing vertex subclass.
- Return type
None
Methods
Optional method for rendering the current state of the environment.
Attributes
Gets the child vertices of this vertex.
Returns: An optional dictionary with additional information about the state
Gets the observation of this vertex.
Gets the vertex observation space, used to define the structure of the data returned when observing a vertex.
Gets the reward for this vertex.
Gets the root vertex of the graph.
Returns: True if this is a terminal vertex in the graph.
- property children: List[graphenv.vertex.V]
Gets the child vertices of this vertex. Acts as a wrapper that memorizes calls to _get_children() and ensures that it is a list. If you would like a different behavior, such as stochastic child vertices, override this property.
- Returns
List of child vertices
- Return type
List[N]
- property info: Dict
Returns: An optional dictionary with additional information about the state
- property observation: any
Gets the observation of this vertex. Acts as a wrapper that memorizes calls to _make_observation(). If you would like a different behavior, such as stochastic observations, override this property.
- Returns
Observation of this vertex.
- abstract property observation_space: gymnasium.spaces.space.Space
Gets the vertex observation space, used to define the structure of the data returned when observing a vertex.
- Returns
Vertex observation space
- Return type
gym.spaces.Space
- render()[source]
Optional method for rendering the current state of the environment.
- Return type
Any
- abstract property reward: float
Gets the reward for this vertex.
- Returns
reward for this vertex
- Return type
float
- abstract property root: graphenv.vertex.V
Gets the root vertex of the graph. Not required to always return the same vertex.
- Returns
The root vertex of the graph.
- Return type
N
- property terminal: bool
Returns: True if this is a terminal vertex in the graph.