diff --git a/src/ArbreB/Graph.gv b/src/ArbreB/Graph.gv index 73753f34eed46ee27d25db0fe551f1f1d6965c40..a6dc586c47baf840b5f9cf1aff8733073f64703d 100644 --- a/src/ArbreB/Graph.gv +++ b/src/ArbreB/Graph.gv @@ -1,3 +1,63 @@ graph { - "[5, 25]" + "[14]" + "[6, 10]" + "[14]" -- "[6, 10]" + "[6, 10]" + "[4]" + "[6, 10]" -- "[4]" + "[4]" + "[2]" + "[4]" -- "[2]" + "[2]" + "[5]" + "[4]" -- "[5]" + "[5]" + "[8]" + "[6, 10]" -- "[8]" + "[8]" + "[7]" + "[8]" -- "[7]" + "[7]" + "[9]" + "[8]" -- "[9]" + "[9]" + "[12]" + "[6, 10]" -- "[12]" + "[12]" + "[11]" + "[12]" -- "[11]" + "[11]" + "[13]" + "[12]" -- "[13]" + "[13]" + "[22, 30]" + "[14]" -- "[22, 30]" + "[22, 30]" + "[18]" + "[22, 30]" -- "[18]" + "[18]" + "[16]" + "[18]" -- "[16]" + "[16]" + "[20]" + "[18]" -- "[20]" + "[20]" + "[26]" + "[22, 30]" -- "[26]" + "[26]" + "[24]" + "[26]" -- "[24]" + "[24]" + "[28]" + "[26]" -- "[28]" + "[28]" + "[34]" + "[22, 30]" -- "[34]" + "[34]" + "[32]" + "[34]" -- "[32]" + "[32]" + "[36]" + "[34]" -- "[36]" + "[36]" } diff --git a/src/ArbreB/Graph.gv.jpg b/src/ArbreB/Graph.gv.jpg index 1d38b922210293ceaf86157a0639b6846bbdffc9..820cb6a0f225e9920aa9e8cd467e450b32131b11 100644 Binary files a/src/ArbreB/Graph.gv.jpg and b/src/ArbreB/Graph.gv.jpg differ diff --git a/src/Visualization.py b/src/Visualization.py index c07b06270e2abc5f6ad6c7f470f22944a8ed0d1a..abf5077f2c2ab5ba0451cfb5f7e7f0aa1035a3d9 100644 --- a/src/Visualization.py +++ b/src/Visualization.py @@ -11,15 +11,14 @@ class Visualization() : self.add_node_to_graph(self.btree.root) def add_node_to_graph(self, node): -# nodeKeys = repr(node.keys) - print(repr(node.keys)) +# print(repr(node.keys)) nodeKeys = repr(node.keys) self.g.node(nodeKeys) for child in node.childs: childKeys = repr(child.keys) self.g.node(childKeys) self.g.edge(nodeKeys, childKeys) - self.add_node_to_graph(childKeys) + self.add_node_to_graph(child) def render(self): self.g.format = 'jpg' diff --git a/src/experimentation.py b/src/experimentation.py index 2566a08e624df928ce70f5fff9a28e1ba99cd04a..0d65c57b2c6780b2be885b49eca6279819538596 100644 --- a/src/experimentation.py +++ b/src/experimentation.py @@ -6,36 +6,41 @@ from BTree import Btree class experimentation: - def __init__(self): + def __init__(self, exp): self.btree = Btree(2, Node([])) - self.experimentationInsert1() - - def experimentationInsert1(self): - #self.btree.insertion(2) - #self.isCorrect(Btree(2,Node([2]))) - - #self.btree.insertion(4) - #self.isCorrect(Btree(2,Node([2,4]))) + if exp == "1": + self.experimentationInsert1() + elif "2": + self.experimentationSuppr1() + else : + None + def experimentationInsert1(self): for n in [2, 4, 5] + list(range(6, 37, 2)) + [7, 9, 11, 13]: self.btree.insertion(n) - #Visualization(self.btree).render() + Visualization(self.btree).render() - print(self.btree) + + def experimentationSuppr1(self): + for n in [2, 4, 5] + list(range(6, 37, 2)) + [7, 9, 11, 13]: + self.btree.insertion(n) + + + #for n in [14,10,20,18,16,24,6] - - def isCorrect(self, BTreeTest): - if (self.btree.equals(BTreeTest)): - print("Correct") - else: - print("error") +# fonction temporaire pour tester la correspondance des arbres de manière automatique et simple visuellement +# def isCorrect(self, BTreeTest): +# if (self.btree.equals(BTreeTest)): +# print("Correct") +# else: +# print("error") @@ -49,7 +54,9 @@ class experimentation: if __name__ == "__main__": - experiment = experimentation() + response = input("Quelle expérimentation voulez vous (1 ou 2)") + experiment = experimentation(response) +