/// <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); }
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); }
public hypergraph_node GetNode(string name) { hypergraph_node node = null; int index = IndexOf(name); if (index > -1) { node = Nodes[index]; } return(node); }
public hypergraph_node GetNode(int ID) { hypergraph_node node = null; int index = IndexOf(ID); if (index > -1) { node = Nodes[index]; } return(node); }
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); } }
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); } }
/// <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); } } }
public bool GetFlagByName(string node_name, int flag_index) { hypergraph_node node = GetNode(node_name); return(node.Flags[flag_index]); }
public void SetFlagByName(string node_name, int flag_index, bool flag_state) { hypergraph_node node = GetNode(node_name); node.Flags[flag_index] = flag_state; }
public bool GetFlagByID(int node_ID, int flag_index) { hypergraph_node node = GetNode(node_ID); return(node.Flags[flag_index]); }
public void SetFlagByID(int node_ID, int flag_index, bool flag_state) { hypergraph_node node = GetNode(node_ID); node.Flags[flag_index] = flag_state; }
/// <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); } } }
public void Remove(hypergraph_node node) { Nodes.Remove(node); }
public void Add(hypergraph_node node) { Nodes.Add(node); }