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
1e6579e7
Commit
1e6579e7
authored
5 years ago
by
Radek Hušek
Browse files
Options
Downloads
Patches
Plain Diff
improve count_cdc
Do not slurp whole input at the beginning and keep extra data in json.
parent
d12c97fb
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
count_cdc.py
+9
-6
9 additions, 6 deletions
count_cdc.py
with
9 additions
and
6 deletions
count_cdc.py
+
9
−
6
View file @
1e6579e7
...
...
@@ -7,19 +7,22 @@ from graph_tools.misc import count_cdc_naive
from
sage.all
import
Graph
from
parmap
import
parmap
def
process
(
g6
):
g6
=
g6
.
rstrip
(
)
G
=
Graph
(
g6
)
def
process
(
l
):
j
=
json
.
loads
(
l
)
G
=
Graph
(
j
[
"
graph
"
]
)
ret
=
count_cdc_naive
(
G
)
return
json
.
dumps
({
"
graph
"
:
g6
,
j
.
update
({
"
cdc_count
"
:
ret
[
0
],
"
n
"
:
G
.
num_verts
(),
"
expected_cdc_lowerbound
"
:
ret
[
1
],
"
is_ok
"
:
(
ret
[
0
]
>=
ret
[
1
])
})
inp
=
[
l
for
l
in
sys
.
stdin
]
return
json
.
dumps
(
j
)
inp
=
os
.
fdopen
(
sys
.
stdin
.
fileno
())
sys
.
stdin
=
None
nprocs
=
int
(
os
.
getenv
(
"
NPROCS
"
,
"
0
"
))
or
None
for
ret
in
parmap
(
process
,
inp
,
nprocs
=
nprocs
,
in_order
=
False
):
...
...
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