def iter_random_4regular_planar_graphs(N_low, N_top, G = None): if G is None: G = octahedron() else: G.is_planar(None, True) # asures an embedding f_list = (phi_A, phi_B, phi_C, phi_F) prob_f = (.25 , .25 , .25 , .25) while G.order() < N_top: f = probabilistic_choice(f_list, prob_f) V = G.order() G = f(G) if V != G.order() and V > N_low: yield G
def random_4regular_planar_graph(N, G = None): if G is None: G = octahedron() else: G.is_planar(None, True) f_list = (phi_A, phi_B, phi_C, phi_F) prob_f = (.80 , .05 , .10 , .05) # prob_f = (.48 , .02 , .48 , .02) # prob_f = (.25 , .25 , .25 , .25) while G.order() < N: f = probabilistic_choice(f_list, prob_f) G = f(G) if not G.is_planar(): raise RuntimeError("non-planar error ") if not G.is_regular(4): raise RuntimeError("non-regular error ") return G