Example #1
0
 public TableNode(GraphNode gnode)
 {
     _gNode = gnode;
     _next = null;
     _prev = null;
     _name = gnode.Name;
 }
Example #2
0
        private void AppendTableNodeList(TableNode head, TableNode node)
        {
            TableNode current = head;

            while (current.Next != null)
            {
                current = current.Next;
            }
            current.Next = node;
            node.Next    = null;
            node.Prev    = current;
        }
Example #3
0
        /// <summary>
        /// Find node with specific name in HashTable
        /// </summary>
        /// <param name="name">name of node</param>
        /// <returns>collection of result</returns>
        public List <GraphNode> FindGNodeListInHashTable(string name)
        {
            List <GraphNode> resultList = new List <GraphNode>();

            TableNode node = AddrGraph.NodeTable[name] as TableNode;

            resultList.Add(node.GNode);

            while (node.Next != null)
            {
                resultList.Add(node.Next.GNode);
                node = node.Next;
            }

            return(resultList);
        }
Example #4
0
 private void AppendTableNodeList(TableNode head,TableNode node)
 {
     TableNode current = head;
     while (current.Next != null)
     {
         current = current.Next;
     }
     current.Next = node;
     node.Next = null;
     node.Prev = current;
 }
Example #5
0
        /// <summary>
        /// Insert a node into graph
        /// </summary>
        /// <param name="NewNode">The node to be inserted</param>
        /// <param name="FatherNode">The node's father node</param>
        /// <returns></returns>
        public bool Insert(GraphNode NewNode,GraphNode FatherNode)
        {
            if (NewNode == null || FatherNode ==null || FatherNode.NextNodeList == null)
            {
                return false;
            }
            if (NewNode.NodeLEVEL <= FatherNode.NodeLEVEL && NewNode.NodeLEVEL != LEVEL.Uncertainty)
            {
                return false;
            }

            TableNode tnode = new TableNode(NewNode);
            Hashtable table = AddrSet.AddrGraph.NodeTable;

            //Add to NodeTable
            if (table.Contains(tnode.Name))
            {
                AppendTableNodeList((TableNode)table[tnode.Name], tnode);
            }
            else
            {
                table.Add(tnode.Name, tnode);
            }

            //Linked to Graph
            FatherNode.NextNodeList.Add(NewNode);

            AddrGraph.NodeCount++;

            return true;
        }