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
56072b89
Commit
56072b89
authored
May 11, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
afb41a07
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+6
-6
No files found.
wcfs/internal/xbtree.py
View file @
56072b89
...
...
@@ -445,7 +445,7 @@ import sys
def
graphviz
(
t
,
clustername
=
''
):
assert
isinstance
(
t
,
Tree
)
symtab
=
{}
#
node
-> name
symtab
=
{}
#
id(node)
-> name
outv
=
[]
def
emit
(
text
):
...
...
@@ -459,13 +459,13 @@ def graphviz(t, clustername=''):
assert
isinstance
(
node
,
(
Tree
,
Bucket
))
# register node insymtab
assert
node
not
in
symtab
assert
id
(
node
)
not
in
symtab
kind
=
(
'T'
if
isinstance
(
node
,
Tree
)
else
'B'
)
symtab
[
node
]
=
'%s%s%d:%d'
%
(
clustername
+
'_'
,
kind
,
level
,
i
)
symtab
[
id
(
node
)
]
=
'%s%s%d:%d'
%
(
clustername
+
'_'
,
kind
,
level
,
i
)
# emit node itself
# approach based on https://github.com/Felerius/btree-generator
emit
(
' %s'
%
qq
(
symtab
[
node
]))
emit
(
' %s'
%
qq
(
symtab
[
id
(
node
)
]))
emit
(
' ['
)
emit
(
' shape = box'
)
emit
(
' margin = 0'
)
...
...
@@ -491,13 +491,13 @@ def graphviz(t, clustername=''):
for
nodev
in
_walkBFS
(
t
):
# same rank for nodes on the same level
emit
(
''
)
emit
(
' {rank=same; %s}'
%
' '
.
join
([
qq
(
symtab
[
_
])
for
_
in
nodev
]))
emit
(
' {rank=same; %s}'
%
' '
.
join
([
qq
(
symtab
[
id
(
_
)
])
for
_
in
nodev
]))
# links
for
node
in
nodev
:
if
not
isinstance
(
node
,
Tree
):
continue
for
(
j
,
child
)
in
enumerate
(
node
.
children
):
emit
(
' %s:"con%d" -> %s'
%
(
qq
(
symtab
[
node
]),
j
,
qq
(
symtab
[
child
])))
emit
(
' %s:"con%d" -> %s'
%
(
qq
(
symtab
[
id
(
node
)]),
j
,
qq
(
symtab
[
id
(
child
)
])))
#emit('}')
emit
(
''
)
...
...
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