Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
graph_drawing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
graph_drawing
Commits
2b6168ce
Commit
2b6168ce
authored
Jan 26, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added is_leaf attribute to Leaf and Node class.
parent
3879a9ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
node.py
node.py
+2
-0
No files found.
node.py
View file @
2b6168ce
...
@@ -5,6 +5,7 @@ class Node(object):
...
@@ -5,6 +5,7 @@ class Node(object):
def
__init__
(
self
,
value
,
*
nodes
):
def
__init__
(
self
,
value
,
*
nodes
):
super
(
Node
,
self
).
__init__
()
super
(
Node
,
self
).
__init__
()
self
.
value
,
self
.
nodes
=
value
,
list
(
nodes
)
self
.
value
,
self
.
nodes
=
value
,
list
(
nodes
)
self
.
is_leaf
=
False
def
__getitem__
(
self
,
n
):
def
__getitem__
(
self
,
n
):
return
self
.
nodes
[
n
]
return
self
.
nodes
[
n
]
...
@@ -37,6 +38,7 @@ class Leaf(Node):
...
@@ -37,6 +38,7 @@ class Leaf(Node):
super
(
Leaf
,
self
).
__init__
(
value
)
super
(
Leaf
,
self
).
__init__
(
value
)
self
.
value
=
value
self
.
value
=
value
self
.
nodes
=
None
self
.
nodes
=
None
self
.
is_leaf
=
True
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
str
(
self
.
value
))
return
len
(
str
(
self
.
value
))
...
...
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