concepts.benchmark.algorithm_env.graph.random_generate_special_graph#

random_generate_special_graph(n, graph_type, directed=False, np_random=None)[source]#

Randomly generate a special type graph.

For list graph, the nodes are randomly permuted and connected in order. If the graph is directed, the edges are directed from the first node to the last node.

Parameters:
  • n (int) – the number of nodes in the graph.

  • graph_type (str) – the type of the graph, e.g. list, tree. Currently only support list.

  • directed (bool) – directed or Undirected graph. Default: False (undirected).

  • np_random (RandomState | None) – the random state.

Returns:

Generated graph.

Return type:

graph