Exemplo n.º 1
0
from graphillion import GraphSet
import graphillion.tutorial as tl

n = 8

universe = tl.grid(n, n)
GraphSet.set_universe(universe)
tl.draw(universe)

start = 1
goal = (n + 1)**2

paths = GraphSet.paths(start, goal)
print(len(paths))
Exemplo n.º 2
0
from graphillion import GraphSet
import graphillion.tutorial as tl

universe = tl.grid(2, 2)
GraphSet.set_universe(universe)
lines = GraphSet({'include': [(8, 9), (5, 8), (4, 5)], 'exclude': [(6, 9)]})
trees = GraphSet.trees(is_spanning=True)
common = trees & lines

for path in common:
    tl.draw(path)
Exemplo n.º 3
0
import graphillion.tutorial as t1
universe = t1.grid(2,2)
GraphSet.set_universe(universe)

print universe

t1.draw(universe)
# -*- coding: utf-8 -*-


from graphillion import GraphSet
import graphillion.tutorial as tl
n=15
m=9
nm = n+m
goal = (n+1)*(m+1)

universe=tl.grid(n,m)
GraphSet.set_universe(universe)

#Gt=GraphSet.paths(1,goal)
#Gs=Gt.graph_size(nm)

Guniv = GraphSet({})
Gss = Guniv.graph_size(nm)
Gs = Gss.paths(1,goal)

#len(Gs)
len(Gs)

for g in Gs.rand_iter():
    tl.draw(g)
    break