from graphly.generator import generator from graphly.algorithm import algorithm g = generator.generate("eulerian", 8) eulerian_circuit = algorithm.find_eulerian_circuit(g) print(" -> ".join(map(str, eulerian_circuit)))
from graphly.algorithm import algorithm from graphly.generator import generator seq = [2, 2, 2, 2, 2, 2, 2] if algorithm.is_degree_seq(seq): g = generator.generate("degree-seq", seq) g.plot("ex02_01.png") algorithm.randomize_graph(g, 3) g.plot("ex02_02.png")
from graphly.generator import generator g = generator.generate("k-regular", 8, 3) g.plot("k-regular.png")
import random from graphly.algorithm import algorithm from graphly.generator import generator g = generator.generate("random-connected", 10) algorithm.randomize_graph(g, 3) print(g.get_edges()) for e in g.get_edges(): e.set_weight(random.randint(1, 10)) print(g.get_edges()) g.plot_weighted("ex01.png")
from graphly.generator import generator g = generator.generate("normal", 7, 14) g.plot() g = generator.generate("probability", 15, 0.05) g.plot()