Created
February 12, 2018 17:59
-
-
Save sakex/68eae7616ce2317dae1cc06247b1baf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node: | |
def __init__(self, name, parent): | |
self.name = name | |
self.parent = parent | |
self.children = {} | |
def addChild(self, childname, weight): | |
child = Node(childname, self) | |
self.children[childname] = { | |
"node": child, | |
"weight": weight | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment