I have a class called Node
class Node:
def __init__(self,name, childList, parentList):
self.name = name
# a list of all nodes which are children of this node
# may have length 0 to many
self.childList = childList
# a list of all nodes which are parents of this node
# may have length 0 to many
self.parentList = parentList
I have a list of Nodes (nodeList). These Nodes may be in each others parentLists or childLists. I want to be able to visualise the relationships between the Nodes dictated in their childLists and parentlists onto stdout (as an ASCII drawing).
e.g where the names below are names of the nodes in the nodeList.
Classifier
|
|
FeatureCombiner
/ \
/ \
/ \
FeatureGenerator1 FeatureGenerator2
\ /
\ /
\ /
\ /
\ /
\ /
\ /
Image Loader
Classifier has an empty parentList and a childList of length 1 containing FeatureCombiner. FeatureGenerator1 and 2 have the same parent and childList containing FeatureCombiner and Image Loader respectively. Image Loader has an empty childList and a parentList containing FeatureGenerator1 and 2.
Thankyou in advance, Matt