diff --git a/models/dimers random walk.xml b/models/dimers random walk.xml
index 89bb2eb..62c20b5 100644
--- a/models/dimers random walk.xml
+++ b/models/dimers random walk.xml
@@ -28,13 +28,13 @@
-
+
- 5
+ 3
@@ -60,12 +60,11 @@
-
-
-
-
-
-
+
+
+
+
+
diff --git a/src/__pycache__/model.cpython-39.pyc b/src/__pycache__/model.cpython-39.pyc
index d04e8cb..6002d34 100644
Binary files a/src/__pycache__/model.cpython-39.pyc and b/src/__pycache__/model.cpython-39.pyc differ
diff --git a/src/glimpse.py b/src/glimpse.py
index e3b8b64..8af6934 100644
--- a/src/glimpse.py
+++ b/src/glimpse.py
@@ -1,4 +1,69 @@
import model
+from anytree import Node, AnyNode, NodeMixin, RenderTree
+from anytree.exporter import DotExporter
+from ete3 import Tree
+
+cset = {(0,0,'root')} # TODO 1) get_node_self_id <> pas de doublon
+ # TODO 2) un node_parent_id existe toujours
+
+for i in range (0, len(model.testmodel.get_conditions().get_condition_array())):
+ cnd = model.testmodel.get_conditions().get_condition(i)
+ cset.add((cnd.get_node_self_id(), cnd.get_node_parent_id(), cnd.get_weight())) # TODO coord
+
+
+class TreeNode(object):
+
+ def __init__(self, id, parent, weight, coord):
+ self.id = id
+ self.parent = parent
+ self.children = None
+ self.weight = weight
+ self.coord = coord
+ self.ch = []
+
+ def id(self): return id
+
+ def add_child(self,ch_id):
+ self.ch.append(ch_id)
+ self.ch = sorted(self.ch, key=id)
+
+
+l = []
+
+tnn = TreeNode(0, 0, 0, 0)
+
+for i in cset: # sorted(cset, key=id):
+ cndt = TreeNode(i[0], i[1], i[2], 0)
+ l.append(cndt)
+
+for i in l:
+ for j in l:
+ if (i.id == j.parent):
+ i.add_child(j)
+ else:
+ i.add_child(tnn)
+
+for i in l:
+ print(i.id,' ',i.parent,' [',i.ch[0].id,' ',i.ch[1].id,' ',i.ch[2].id,' ',i.ch[3].id,' ',i.ch[4].id,']')
+
+
+
+
+
+
+
+
+##
+
+
+
+
+
+
+
+
+
+
sp = model.testmodel.get_states().get_space(0)
@@ -50,3 +115,5 @@ for i in range (0, size + nb_sites - 1):
print (cells)
print()
print (space)
+
+
diff --git a/src/model.py b/src/model.py
index 411b5d1..3328bc7 100644
--- a/src/model.py
+++ b/src/model.py
@@ -280,16 +280,16 @@ class Condition:
def set_weight(self, weight):
self.node.attrib["weight"] = str(weight)
- def get_node_id(self):
+ def get_node_self_id(self):
return int(self.node.get("node_id"))
- def set_node_id(self, node_id):
+ def set_node_self_id(self, node_id):
self.node.attrib["node_id"] = str(node_id)
- def get_parent(self):
+ def get_node_parent_id(self):
return int(self.node.get("parent"))
- def set_parent(self, parent):
+ def set_node_parent_id(self, parent):
self.node.attrib["parent"] = str(parent)
@@ -302,6 +302,11 @@ class Conditions:
if(child.tag == "condition"):
self.__conditions.append(Condition(child))
+ def get_condition(self, i):
+ return self.__conditions[i]
+
+ def get_condition_array(self):
+ return self.__conditions
class Transition:
__arrows = []
@@ -323,12 +328,12 @@ class Transitions:
self.node = node
for child in node:
if(child.tag == "transition"):
- self.__transition.append(Transition(child))
+ self.__transitions.append(Transition(child))
def get_transition(self, i):
return self.__transitions[i]
- def get_transition_array(self, i):
+ def get_transition_array(self):
return self.__transitions
## Model
@@ -385,7 +390,7 @@ class Model:
self.__states = child
if(child.tag == "conditions"):
self.__conditions = child
- if(child.tag == "transition"):
+ if(child.tag == "transitions"):
self.__transitions = child
def get_identity(self):
@@ -415,4 +420,8 @@ schemaPath = "../schemas/models_0.2.1.xmls"
testmodel = Model(modelPath, schemaPath)
+# print(testmodel.get_conditions().get_condition(0).get_weight())
+
+
+
# TODO weight_max