Beispiel #1
0
 public Node(string name, int generation, Node mother, Node father)
 {
     Name = name;
     Generation = generation;
     MotherNode = mother;
     FatherNode = father;
     Mother = mother.Name;
     Father = father.Name;
 }
Beispiel #2
0
        public AncestryTree PopulateTree(Dictionary<string, Node> d)
        {
            //define array to construct nodes:
            Node[] nodeArray = new Node[int.Parse(d.Keys.Last()) + 1];
            //calculate the max generation in the pedigree tree
            //using the forumla 2^(gen)-1 = # of nodes:
            var max_generation = Math.Ceiling(Math.Log(nodeArray.Count() + 1, 2));
            for (int i = nodeArray.Count()-1; i >= 0; i--)
            {
                if (d.ContainsKey(i.ToString()))
                {
                    //create node from dictionary data

                }
            }
        }
Beispiel #3
0
 public List<Node> FlattenTree()
 {
     List<Node> nodelist = new List<Node>();
     Queue<Node> q = new Queue<Node>();
     q.Enqueue(root);
     while(q.Count > 0)
     {
         Node n = q.Dequeue();
         if (n!=null)
         {
             Node k = new Node(n.Name, n.Generation, n.Mother, n.Father);
             nodelist.Add(k);
             q.Enqueue(n.FatherNode);
             q.Enqueue(n.MotherNode);
         }
     }
     return nodelist;
 }
Beispiel #4
0
 public AncestryTree(Node Root)
 {
     root = Root;
 }
Beispiel #5
0
 public AncestryTree()
 {
     root = null;
 }