예제 #1
0
        /// <summary>
        /// removes the given link from the graph
        /// </summary>
        /// <param name="victim">
        /// link object to be removed <see cref="hypergraph_link"/>
        /// </param>
        public void RemoveLink(hypergraph_link victim)
        {
            hypergraph_node node = victim.To;

            node.Links.Remove(victim);
            Links.Remove(victim);
        }
예제 #2
0
 public void LinkByReference(hypergraph_node from_node, hypergraph_node to_node,
                             hypergraph_link link)
 {
     link.From = from_node;
     link.To   = to_node;
     link.To.Add(link);
     Links.Add(link);
 }
예제 #3
0
        public hypergraph_node GetNode(string name)
        {
            hypergraph_node node  = null;
            int             index = IndexOf(name);

            if (index > -1)
            {
                node = Nodes[index];
            }
            return(node);
        }
예제 #4
0
        public hypergraph_node GetNode(int ID)
        {
            hypergraph_node node  = null;
            int             index = IndexOf(ID);

            if (index > -1)
            {
                node = Nodes[index];
            }
            return(node);
        }
예제 #5
0
 public hypergraph(int no_of_nodes, int no_of_flags)
 {
     Nodes = new List <hypergraph_node>();
     Links = new List <hypergraph_link>();
     for (int i = 0; i < no_of_nodes; i++)
     {
         hypergraph_node node = new hypergraph_node(no_of_flags);
         node.ID   = i;
         node.Name = i.ToString();
         Add(node);
     }
 }
예제 #6
0
 public hypergraph(int no_of_nodes, int no_of_flags)
 {
     Nodes = new List<hypergraph_node>();
     Links = new List<hypergraph_link>();
     for (int i = 0; i < no_of_nodes; i++)
     {
         hypergraph_node node = new hypergraph_node(no_of_flags);
         node.ID = i;
         node.Name = i.ToString();
         Add(node);
     }
 }
예제 #7
0
 /// <summary>
 /// propogates the given flag index from the given node
 /// </summary>
 /// <param name="node">
 /// A <see cref="hypergraph_node"/>
 /// </param>
 /// <param name="flag_index">
 /// A <see cref="System.Int32"/>
 /// </param>
 /// <param name="members">
 /// A <see cref="List`1"/>
 /// </param>
 public void PropogateFlag(hypergraph_node node, int flag_index, List <hypergraph_node> members)
 {
     if (node.Flags[flag_index] == false)
     {
         node.Flags[flag_index] = true;
         members.Add(node);
         for (int i = 0; i < node.Links.Count; i++)
         {
             hypergraph_link link = node.Links[i];
             PropogateFlag(link.From, flag_index, members);
         }
     }
 }
예제 #8
0
        public bool GetFlagByName(string node_name, int flag_index)
        {
            hypergraph_node node = GetNode(node_name);

            return(node.Flags[flag_index]);
        }
예제 #9
0
        public void SetFlagByName(string node_name, int flag_index, bool flag_state)
        {
            hypergraph_node node = GetNode(node_name);

            node.Flags[flag_index] = flag_state;
        }
예제 #10
0
        public bool GetFlagByID(int node_ID, int flag_index)
        {
            hypergraph_node node = GetNode(node_ID);

            return(node.Flags[flag_index]);
        }
예제 #11
0
        public void SetFlagByID(int node_ID, int flag_index, bool flag_state)
        {
            hypergraph_node node = GetNode(node_ID);

            node.Flags[flag_index] = flag_state;
        }
예제 #12
0
 /// <summary>
 /// propogates the given flag index from the given node
 /// </summary>
 /// <param name="node">
 /// A <see cref="hypergraph_node"/>
 /// </param>
 /// <param name="flag_index">
 /// A <see cref="System.Int32"/>
 /// </param>
 /// <param name="members">
 /// A <see cref="List`1"/>
 /// </param>
 public void PropogateFlag(hypergraph_node node, int flag_index, List<hypergraph_node> members)
 {
     if (node.Flags[flag_index] == false)
     {
         node.Flags[flag_index] = true;
         members.Add(node);
         for (int i = 0; i < node.Links.Count; i++)
         {
             hypergraph_link link = node.Links[i];
             PropogateFlag(link.From, flag_index, members);
         }
     }
 }
예제 #13
0
 public void Remove(hypergraph_node node)
 {
     Nodes.Remove(node);
 }
예제 #14
0
 public void Add(hypergraph_node node)
 {
     Nodes.Add(node);
 }
예제 #15
0
 public void Add(hypergraph_node node)
 {
     Nodes.Add(node);
 }
예제 #16
0
 public void Remove(hypergraph_node node)
 {
     Nodes.Remove(node);
 }
예제 #17
0
 public void LinkByReference(hypergraph_node from_node, hypergraph_node to_node,
                             hypergraph_link link)
 {
     link.From = from_node;
     link.To = to_node;
     link.To.Add(link);
     Links.Add(link);
 }