Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
03f27262
Commit
03f27262
authored
May 04, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ce5ef12e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+5
-7
wcfs/internal/xbtree_test.py
wcfs/internal/xbtree_test.py
+2
-0
No files found.
wcfs/internal/xbtree.py
View file @
03f27262
...
...
@@ -164,26 +164,24 @@ def _iterAllStructs(klo, khi, keyv, maxdepth, maxsplit):
for
nsplit
in
range
(
0
,
maxsplit
):
for
ksplitv
in
_iterSplitByN
(
klo
,
khi
,
nsplit
):
# child_i
xlo
,
xhi
# ksplitv = [klo, s1, s2, ..., sN, khi]
# emit Tree -> Buckets
children
=
[]
for
xlo
,
xhi
in
...:
for
(
xlo
,
xhi
)
in
zip
(
ksplitv
[:
-
1
],
ksplitv
[
1
:]):
# (klo, s1), (s1, s2), ..., (sN, khi)
children
.
append
(
Bucket
(
*
_keyvSliceBy
(
keyv
,
xlo
,
xhi
)))
yield
Tree
(
ksplitv
,
children
)
# FIXME ksplitv wo klo/khi
yield
Tree
(
ksplitv
[
1
:
-
1
],
*
children
)
# (s1, s2, ..., sN)
# emit Tree -> Trees -> ...
if
maxdepth
==
0
:
continue
ichildren
=
[]
# of _iterAllStructs for each child link
for
xlo
,
xhi
in
...:
for
(
xlo
,
xhi
)
in
zip
(
ksplitv
[:
-
1
],
ksplitv
[
1
:]):
# (klo, s1), (s1, s2), ..., (sN, khi)
ichildren
.
append
(
_iterAllStructs
(
xlo
,
xhi
,
_keyvSliceBy
(
keyv
,
xlo
,
xhi
),
maxdepth
-
1
,
maxsplit
))
for
children
in
itertools
.
product
(
ichildren
):
yield
Tree
(
ksplitv
,
*
children
)
# FIXME ksplitv w/o klo, khi
yield
Tree
(
ksplitv
[
1
:
-
1
],
*
children
)
# (s1, s2, ..., sN)
# _keyvSliceBy returns [] of keys from keyv : k ∈ [klo, khi)
...
...
wcfs/internal/xbtree_test.py
View file @
03f27262
...
...
@@ -57,6 +57,8 @@ def test_topologyOf():
(4,), (2,),(), (),(),(6,10), B(1),B(3),(),(),(), (),B(7),B(11), B(5)
# T4 T2-T T-T-T6,10 B1-B3-T-T-T T-B7-B11 B5 <-- good
# T4·T2-T·T-T-T6,10·B1-B3-T-T-T·T-B7-B11·B5. <- ?
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment