Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdc-counting
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Radek Hušek
cdc-counting
Commits
1dac5bb5
Commit
1dac5bb5
authored
5 years ago
by
Radek Hušek
Browse files
Options
Downloads
Patches
Plain Diff
bump
parent
8eaeea23
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
analyze-cut.py
+99
-0
99 additions, 0 deletions
analyze-cut.py
count_cdc.py
+11
-0
11 additions, 0 deletions
count_cdc.py
with
110 additions
and
0 deletions
analyze-cut.py
0 → 100644
+
99
−
0
View file @
1dac5bb5
from
flower_snarks
import
*
from
sage.all
import
*
from
collections
import
namedtuple
from
itertools
import
*
def
calc
(
s
):
b
=
list
(
CircuitDoubleCover
.
enumerate_boundaries
(
s
))
m
=
matrix
(
QQ
,
len
(
b
),
len
(
b
),
dict
(),
sparse
=
True
)
for
c
,
cb
in
enumerate
(
b
):
for
r
,
rb
in
enumerate
(
b
):
rg
=
FakeGadget
(
s
,
[
Boundary
(
rb
,
1
)
])
cg
=
FakeGadget
(
s
,
[
Boundary
(
cb
,
1
)
])
m
[
r
,
c
]
=
Gadget
.
join
(
[
cg
,
rg
],
[
((
1
,
i
),
(
2
,
i
))
for
i
in
range
(
1
,
s
+
1
)
],
[]
).
eval
(
CircuitDoubleCover
)
assert
m
.
is_symmetric
()
_bmap
=
{
x
:
i
for
i
,
x
in
enumerate
(
b
)
}
def
eval_
(
g
):
ret
=
set
()
for
b_
in
(
_bmap
[
x
.
boundary
]
for
x
in
g
.
eval
(
CircuitDoubleCover
)
if
x
.
value
>
0
):
ret
.
update
(
set
(
m
.
column
(
b_
).
support
()))
return
ret
ret
=
namedtuple
(
"
calc_ret
"
,
[
"
matrix
"
,
"
boundaries
"
,
"
eval
"
,
"
map
"
])
ret
.
matrix
=
m
ret
.
boundaries
=
b
ret
.
eval
=
eval_
ret
.
map
=
lambda
x
:
_bmap
[
x
]
return
ret
G1
=
Gadget
.
join
([
FREE_EDGE
]
*
2
,
[],
[(
1
,
1
),(
1
,
2
),(
2
,
1
),(
2
,
2
)])
G2
=
Gadget
.
join
([
CUBIC_VERTEX
]
*
2
,
[((
1
,
1
),
(
2
,
1
))],
[(
1
,
2
),
(
1
,
3
),
(
2
,
2
),
(
2
,
3
)])
#G = Gadget.join([CUBIC_VERTEX]*4, [((1,2), (2,1)), ((2,2), (3,1)), ((3,2), (4,1)), ((4,2), (1,1))],
# [(1,3), (2,3), (3,3), (4,3)])
def
C_k
(
k
):
return
Gadget
.
join
(
[
CUBIC_VERTEX
]
*
k
,
[
((
i
+
1
,
2
),
(((
i
+
1
)
%
k
)
+
1
,
1
))
for
i
in
range
(
k
)
],
[
(
i
+
1
,
3
)
for
i
in
range
(
k
)
]
)
k
=
4
X
=
calc
(
k
)
m
=
str
(
X
.
matrix
)
m
=
m
.
replace
(
"
0
"
,
"
"
)
print
(
m
)
print
(
len
(
X
.
boundaries
))
print
(
"
\n
"
)
S
=
[]
#for x in X.boundaries: print(x)
for
G
in
[
G1
,
G2
]:
for
i
in
range
(
1
,
4
):
o
=
[
(
1
,
1
),
(
1
,
3
),
(
1
,
4
)
]
o
.
insert
(
i
,
(
1
,
2
))
g
=
Gadget
.
join
([
G
],
[],
o
)
e
=
X
.
eval
(
g
)
S
.
append
(
e
)
print
(
o
)
print
(
e
)
print
(
len
(
e
))
print
(
"
\n\n
================================
\n
"
)
L
=
[]
for
l
in
range
(
4
):
for
c
in
combinations
(
range
(
len
(
X
.
boundaries
)),
l
):
c
=
set
(
c
)
if
not
all
(
len
(
c
.
intersection
(
s
))
>
0
for
s
in
S
):
continue
L
.
append
(
c
)
# print(c)
def
meet
(
R
,
C
):
for
r
in
R
:
for
c
in
C
:
if
X
.
matrix
[
r
,
c
]:
return
True
return
False
def
test
():
for
R
in
L
:
for
C
in
L
:
if
not
meet
(
R
,
C
):
print
(
R
,
C
)
test
()
This diff is collapsed.
Click to expand it.
count_cdc.py
0 → 100755
+
11
−
0
View file @
1dac5bb5
#!/usr/bin/python
from
sys
import
stdin
from
sage.all
import
Graph
from
flower_snarks
import
count_cdc_naive
for
l
in
stdin
:
G
=
Graph
(
l
)
cdc
,
hyp
=
count_cdc_naive
(
G
)
print
(
"
%-20i %s
"
%
(
cdc
,
""
if
cdc
>=
hyp
else
"
FAIL
"
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment