Skip to content
Snippets Groups Projects
Commit 0908de92 authored by Loic Scoth's avatar Loic Scoth
Browse files

experimentation

parent 147b13b0
No related branches found
No related tags found
No related merge requests found
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]"
}
src/ArbreB/Graph.gv.jpg

2.7 KiB | W: | H:

src/ArbreB/Graph.gv.jpg

42.3 KiB | W: | H:

src/ArbreB/Graph.gv.jpg
src/ArbreB/Graph.gv.jpg
src/ArbreB/Graph.gv.jpg
src/ArbreB/Graph.gv.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -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'
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment