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

render

Optional method for rendering the current state of the environment.

Attributes

children

Gets the child vertices of this vertex.

info

Returns: An optional dictionary with additional information about the state

observation

Gets the observation of this vertex.

observation_space

Gets the vertex observation space, used to define the structure of the data returned when observing a vertex.

reward

Gets the reward for this vertex.

root

Gets the root vertex of the graph.

terminal

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.