Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5fffda commit a6e1303Copy full SHA for a6e1303
fp_growth.py
@@ -23,6 +23,11 @@ def __init__(self):
23
# "neighbors" that will hit every node containing that item.
24
self._routes = {}
25
26
+ @property
27
+ def root(self):
28
+ """The root node of the tree."""
29
+ return self._root
30
+
31
def add(self, transaction):
32
"""
33
Adds a transaction to the tree.
@@ -133,6 +138,11 @@ def root(self):
133
138
"""True if this node is the root of a tree; false if otherwise."""
134
139
return self._item is None and self._count is None
135
140
141
142
+ def leaf(self):
143
+ """True if this node is a leaf in the tree; false if otherwise."""
144
+ return len(self._children) == 0
145
136
146
def parent():
137
147
doc = "The node's parent."
148
def fget(self):
0 commit comments