concepts.benchmark.algorithm_env.graph.random_generate_special_graph#

random_generate_special_graph(n, graph_type, directed=False)[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).

Returns:

Generated graph.

Return type:

graph