teachpyx.video.tsp_kruskal

teachpyx.video.tsp_kruskal_pygame.pygame_simulation(size: Tuple[int, int] = (800, 500), zone: int = 20, length: int = 10, max_iter: int | None = None, nb: int = 700, pygame=None, folder=None, first_click: bool = False, distance=None, flags=0, verbose: int = 0)[source][source]
Paramètres:
  • pygame – module pygame

  • nb – number of cities

  • first_click – attend la pression d’un clic de souris avant de commencer

  • folder – répertoire où stocker les images de la simulation

  • size – taille de l’écran

  • delay – delay between two tries

  • folder – folder where to save images

  • distance – distance function

  • flags – see pygame.display.set_mode

  • verbose – verbosity

Renvoie:

see tsp_kruskal_algorithm

La simulation ressemble à ceci :

Pour lancer la simulation:

import pygame
from teachpyx.video.tsp_kruskal_pygame import pygame_simulation
pygame_simulation(pygame)

Voir Circuit hamiltonien et Kruskal.