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
2dda89dd
Commit
2dda89dd
authored
Jun 4, 2020
by
Radek Hušek
Browse files
Options
Downloads
Patches
Plain Diff
tests
parent
b3c4a53e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
graph_tools/tests.py
+20
-5
20 additions, 5 deletions
graph_tools/tests.py
with
20 additions
and
5 deletions
graph_tools/tests.py
+
20
−
5
View file @
2dda89dd
...
@@ -3,10 +3,12 @@
...
@@ -3,10 +3,12 @@
>>>
from
.all
import
*
>>>
from
.all
import
*
>>>
from
sage.all
import
*
>>>
from
sage.all
import
*
>>>
is_isomorphic
=
lambda
g
,
gadget
:
g
.
is_isomorphic
(
gadget
.
eval
(
UnderlayingGraph
))
>>>
g2g
=
lambda
gadget
:
gadget
.
eval
(
UnderlayingGraph
)
>>>
assert
is_isomorphic
(
graphs
.
CompleteGraph
(
4
),
Necklace
.
graph
(
1
))
>>>
assert
graphs
.
CompleteGraph
(
4
).
is_isomorphic
(
g2g
(
Necklace
.
graph
(
1
)))
>>>
assert
is_isomorphic
(
graphs
.
PetersenGraph
(),
Petersen
)
>>>
assert
graphs
.
PetersenGraph
().
is_isomorphic
(
g2g
(
Petersen
))
>>>
assert
all
(
\
g2g
(
CyclicLadder
().
graph
(
i
)).
is_isomorphic
(
g2g
(
GeneralizedPetersen
(
1
).
graph
(
i
)))
\
for
i
in
range
(
3
,
20
)
)
>>>
cdc_count
=
lambda
gadget
:
gadget
.
eval
(
CircuitDoubleCover
)
>>>
cdc_count
=
lambda
gadget
:
gadget
.
eval
(
CircuitDoubleCover
)
>>>
cdc_count
(
Petersen
)
>>>
cdc_count
(
Petersen
)
52
52
...
@@ -18,13 +20,26 @@
...
@@ -18,13 +20,26 @@
True
True
>>>
all
(
cdc_count
(
Flower
.
graph
(
k
))
==
(
2
**
(
k
-
1
)
+
(
-
1
)
**
k
)
//
3
+
1
for
k
in
range
(
3
,
20
)
)
>>>
all
(
cdc_count
(
Flower
.
graph
(
k
))
==
(
2
**
(
k
-
1
)
+
(
-
1
)
**
k
)
//
3
+
1
for
k
in
range
(
3
,
20
)
)
True
True
>>>
Necklace
.
stabilize
(
CircuitDoubleCover
)
>>>
Necklace
.
stabilize
(
CircuitDoubleCover
)
Loop
1
done
-
1
boundaries
(
0
new
)
Loop
1
done
-
1
boundaries
(
0
new
)
{
'
variables
'
:
[((
1
,
2
),
(
1
,
2
),
None
)],
'
step_matrix
'
:
[
4
],
'
initial_vector
'
:
[
2
],
\
{
'
variables
'
:
[((
1
,
2
),
(
1
,
2
),
None
)],
'
step_matrix
'
:
[
4
],
'
initial_vector
'
:
[
2
],
\
'
finalize
'
:
[
1
],
'
simplified
'
:
([
1
],
[
4
],
[
2
]),
'
formula
'
:
1
/
2
*
4
^
k
}
'
finalize
'
:
[
1
],
'
simplified
'
:
([
1
],
[
4
],
[
2
]),
'
formula
'
:
1
/
2
*
4
^
k
,
'
formula_if
'
:
k
-
1
>=
0
}
>>>
Flower
.
stabilize
(
CircuitDoubleCover
,
2
)[
'
formula
'
]
>>>
Flower
.
stabilize
(
CircuitDoubleCover
,
2
)[
'
formula
'
]
Loop
1
done
-
3
boundaries
(
0
new
)
Loop
1
done
-
3
boundaries
(
0
new
)
1
/
3
*
2
^
(
k
-
1
)
+
1
/
3
*
(
-
1
)
^
k
+
1
1
/
3
*
2
^
(
k
-
1
)
+
1
/
3
*
(
-
1
)
^
k
+
1
>>>
f
=
CyclicLadder
().
stabilize
(
CircuitDoubleCover
,
start_at
=
1
)[
'
formula
'
];
f
Loop
1
done
-
6
boundaries
(
6
new
)
Loop
2
done
-
13
boundaries
(
6
new
)
Loop
3
done
-
15
boundaries
(
2
new
)
Loop
4
done
-
15
boundaries
(
0
new
)
1
/
2
*
(
-
1
)
^
k
*
(
k
-
1
)
+
1
/
6
*
4
^
(
k
-
1
)
+
3
*
2
^
(
k
-
1
)
+
1
/
3
*
(
-
2
)
^
(
k
-
2
)
-
5
/
2
*
k
-
3
/
2
>>>
assert
all
(
f
(
k
=
k
)
==
cdc_count
(
CyclicLadder
().
graph
(
k
))
for
k
in
range
(
3
,
10
)
)
>>>
f
=
CyclicLadder
(
crossed
=
True
).
stabilize
(
CircuitDoubleCover
,
start_at
=
3
)[
'
formula
'
];
f
Loop
1
done
-
12
boundaries
(
4
new
)
Loop
2
done
-
14
boundaries
(
0
new
)
-
1
/
2
*
(
-
1
)
^
k
*
k
+
1
/
6
*
4
^
(
k
-
1
)
+
3
*
2
^
(
k
-
1
)
+
1
/
3
*
(
-
2
)
^
(
k
-
2
)
-
5
/
2
*
k
>>>
assert
all
(
f
(
k
=
k
)
==
cdc_count
(
CyclicLadder
(
True
).
graph
(
k
))
for
k
in
range
(
3
,
10
)
)
>>>
sun_cdc
=
lambda
n
:
sum
(
b
.
value
for
b
in
sun
(
n
).
eval_gadget
(
CircuitDoubleCover
)
)
>>>
sun_cdc
=
lambda
n
:
sum
(
b
.
value
for
b
in
sun
(
n
).
eval_gadget
(
CircuitDoubleCover
)
)
>>>
all
(
sun_cdc
(
n
)
==
2
**
n
-
2
*
n
for
n
in
range
(
3
,
10
)
)
>>>
all
(
sun_cdc
(
n
)
==
2
**
n
-
2
*
n
for
n
in
range
(
3
,
10
)
)
True
True
...
...
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
sign in
to comment