class_docstr: A space representing graph information as a series of `nodes` connected with `edges` according to an adjacency matrix represented as a series of `edge_links`.
  
  Example usage::
  
      self.observation_space = spaces.Graph(node_space=space.Box(low=-100, high=100, shape=(3,)), edge_space=spaces.Discrete(3))
class_docstr_tok: ["A","space","representing","graph","information","as","a","series","of","`","nodes","`","connected","with","`","edges","`","according","to","an","adjacency","matrix","represented","as","a","series","of","`","edge_links","`",".","Example","usage",":",":","self.observation_space","=","spaces.Graph","(","node_space=space.Box","(","low=-100",",","high=100",",","shape=","(","3",",",")",")",",","edge_space=spaces.Discrete","(","3",")",")"]
docstr: Constructor of :class:`Graph`.
  
  The argument ``node_space`` specifies the base space that each node feature will use.
  This argument must be either a Box or Discrete instance.
  
  The argument ``edge_space`` specifies the base space that each edge feature will use.
  This argument must be either a None, Box or Discrete instance.
  
  Args:
      node_space (Union[Box, Discrete]): space of the node features.
      edge_space (Union[None, Box, Discrete]): space of the node features.
      seed: Optionally, you can use this argument to seed the RNG that is used to sample from the space.
docstr_tok: ["Constructor","of",":","class",":","`","Graph","`",".","The","argument","``","node_space","``","specifies","the","base","space","that","each","node","feature","will","use",".","This","argument","must","be","either","a","Box","or","Discrete","instance",".","The","argument","``","edge_space","``","specifies","the","base","space","that","each","edge","feature","will","use",".","This","argument","must","be","either","a","None",",","Box","or","Discrete","instance",".","Args",":","node_space","(","Union","[","Box",",","Discrete","]",")",":","space","of","the","node","features",".","edge_space","(","Union","[","None",",","Box",",","Discrete","]",")",":","space","of","the","node","features",".","seed",":","Optionally",",","you","can","use","this","argument","to","seed","the","RNG","that","is","used","to","sample","from","the","space","."]
code: def __init__(
      self,
      node_space: Union[Box, Discrete],
      edge_space: Union[None, Box, Discrete],
      seed: Optional[Union[int, np.random.Generator]] = None,
  ):
      r"""Constructor of :class:`Graph`.
  
      The argument ``node_space`` specifies the base space that each node feature will use.
      This argument must be either a Box or Discrete instance.
  
      The argument ``edge_space`` specifies the base space that each edge feature will use.
      This argument must be either a None, Box or Discrete instance.
  
      Args:
          node_space (Union[Box, Discrete]): space of the node features.
          edge_space (Union[None, Box, Discrete]): space of the node features.
          seed: Optionally, you can use this argument to seed the RNG that is used to sample from the space.
      """
      assert isinstance(
          node_space, (Box, Discrete)
      ), f"Values of the node_space should be instances of Box or Discrete, got {type(node_space)}"
      if edge_space is not None:
          assert isinstance(
              edge_space, (Box, Discrete)
          ), f"Values of the edge_space should be instances of None Box or Discrete, got {type(node_space)}"
  
      self.node_space = node_space
      self.edge_space = edge_space
  
      super().__init__(None, None, seed)
  
file_path: gym/gym/spaces/graph.py
imports: from typing import NamedTuple, Optional, Sequence, Tuple, Union
  import numpy
  from gym.logger import warn
  from gym.spaces.box import Box
  from gym.spaces.discrete import Discrete
  from gym.spaces.multi_discrete import MultiDiscrete
  from gym.spaces.space import Space
label_desc: Use image node_id 1 to create a new Graph object from inherited base classes: Space with example: obj = Graph(node_space, edge_space, seed)