# Path: difflogic/envs/graph/graph.py
# def get_random_graph_generator(name):
#   if name == 'dnc':
#     return randomly_generate_graph_dnc
#   return randomly_generate_graph_er


import numpy as np
import jacinle.random as random
from jacinle.utils.meta import notnone_property
from jaclearn.rl.env import SimpleRLEnvBase
from .graph import get_random_graph_generator
               nr_nodes,
               pmin,
               pmax=None,
               directed=False,
               gen_method='dnc'):
    super().__init__()
    self._nr_nodes = nr_nodes
    self._pmin = pmin
    self._pmax = pmin if pmax is None else pmax
    self._directed = directed
    self._gen_method = gen_method
    self._graph = None

  @notnone_property
  def graph(self):
    return self._graph

  @property
  def nr_nodes(self):
    return self._nr_nodes

  def _restart(self):
    """Restart the environment."""
    self._gen_graph()

  def _gen_graph(self):
    """generate the graph by specified method."""
    n = self._nr_nodes
    p = self._pmin + random.rand() * (self._pmax - self._pmin)
    assert self._gen_method in ['edge', 'dnc']

# Path: difflogic/envs/graph/graph.py
# def get_random_graph_generator(name):
#   if name == 'dnc':
#     return randomly_generate_graph_dnc
#   return randomly_generate_graph_er


# Path: difflogic/envs/graph/graph_env.py
import numpy as np
import jacinle.random as random
from jacinle.utils.meta import notnone_property
from jaclearn.rl.env import SimpleRLEnvBase
from .graph import get_random_graph_generator

               nr_nodes,
               pmin,
               pmax=None,
               directed=False,
               gen_method='dnc'):
    super().__init__()
    self._nr_nodes = nr_nodes
    self._pmin = pmin
    self._pmax = pmin if pmax is None else pmax
    self._directed = directed
    self._gen_method = gen_method
    self._graph = None

  @notnone_property
  def graph(self):
    return self._graph

  @property
  def nr_nodes(self):
    return self._nr_nodes

  def _restart(self):
    """Restart the environment."""
    self._gen_graph()

  def _gen_graph(self):
    """generate the graph by specified method."""
    n = self._nr_nodes
    p = self._pmin + random.rand() * (self._pmax - self._pmin)
    assert self._gen_method in ['edge', 'dnc']

    gen = get_random_graph_generator(self._gen_method)