graphenv.examples.tsp.graph_utils.random_tsp

random_tsp(G, weight='weight', source=None, seed=None)[source]

Return a baseline cost cycle starting at source and its cost. Randomly chooses nodes from each position.

Parameters
  • G – The Graph should be a complete weighted undirected graph.

  • weight – string, optional (default=”weight”).

  • source – node, optional (default: first node in list(G))

  • seed – Optional(int) a random seed

Returns

list of nodes

Return type

cycle