-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.sage
90 lines (76 loc) · 1.97 KB
/
examples.sage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
load("pattern-graphs.sage")
'''
Uncomment what you want to run
'''
'''
Example 1 from proposal
'''
perm = Permutation([3,5,1,2,4])
p = [1,2]
P = [1,2,3]
GpP = pattgraph(perm,p,P)
show(GpP)
'''
Example 2 from proposal
'''
# perm = Permutation([3,5,1,2,4])
# p = [1,2]
# P = [1,3,2]
# GpP = pattgraph(perm, p, P)
# show(GpP)
'''
Problem 2.1
Testing if it is true for permutations up to length N
'''
# N = 6
# p = [1,2]
# P = [1,2,3]
# for n in range(N+1):
# print 'Looking at permutations of length %d' %n
# for perm in Permutations(n):
# GpP = pattgraph(perm, p, P)
# if GpP.is_bipartite() != perm.avoids([1,2,3]):
# print '%d is a counter-example!' %perm
'''
Problem 2.2
Testing if it is true for permutations up to length N
'''
# N = 6
# p = [1,2]
# P = [1,3,2]
# for n in range(N+1):
# print 'Looking at permutations of length %d' %n
# for perm in Permutations(n):
# GpP = pattgraph(perm, p, P)
# if GpP.is_bipartite() != perm.avoids([1,4,3,2]):
# print '%d is a counter-example!' %perm
'''
Problem 2.3
Testing if it is true for permutations up to length N
'''
# N = 6
# p = [1,2]
# P = [1,2,3]
# for n in range(N+1):
# print 'Looking at permutations of length %d' %n
# for perm in Permutations(n):
# GpP = pattgraph(perm, p, P)
# verts = GpP.vertices()
# edg = GpP.edges()
# if GpP.is_clique() != (len(verts) <= 1 or (len(verts) == 3 and len(edg) == 3)):
# print '%d is a counter-example!' %perm
'''
Problem 2.4
Testing if it is true for permutations up to length N
'''
# N = 6
# p = [1,2]
# P = [1,3,2]
# for n in range(N+1):
# print 'Looking at permutations of length %d' %n
# for perm in Permutations(n):
# GpP = pattgraph(perm, p, P)
# verts = GpP.vertices()
# edg = GpP.edges()
# if GpP.is_clique() != (perm.avoids([1,2,3]) and perm.avoids([2,1,3]) and perm.avoids([3,4,1,2])):
# print '%d is a counter-example!' %perm