public void getMfList(T seed, out List <T> mfs, String filter = null) { mfs = new List <T>(); if (!network.ContainsKey(seed)) { return; } HoningNode <T> node = network[seed]; foreach (KeyValuePair <T, HoningNode <T> > n in node.clique) { if (filter != null) { if (n.Value.mark == filter) { if (n.Value.mark != "terminal") { mfs.Add(n.Value.holder); } } } else if (n.Value.mark != "terminal") { mfs.Add(n.Value.holder); } } }
public int countMicrofeatures(List <T> baseVector) { int count = 0; foreach (T value in baseVector) { HoningNode <T> node = network[value]; count += node.clique.Count; } return(count); }
public void setParent(T seed, T clique_obj) { if (network.ContainsKey(seed) && network.ContainsKey(clique_obj)) { HoningNode <T> node = network[seed]; if (!node.clique.ContainsKey(clique_obj)) { HoningNode <T> cliqueNode = network[clique_obj]; node.clique.Add(clique_obj, cliqueNode); cliqueNode.parents.Add(seed, node); } } }
public List <T> getTerminalList() { List <T> n = new List <T>(); foreach (T key in network.Keys) { HoningNode <T> current = network[key]; if (current.mark == "terminal") { n.Add(current.holder); } } return(n); }
public bool checkMicrofeature(T seed, T microfeature) { bool check = false; if (!network.ContainsKey(seed)) { return(check); } HoningNode <T> node = network[seed]; if (!node.clique.ContainsKey(microfeature)) { return(check); } return(check = true); }
public void reinforceNet(T seeker, ref HoningNetwork <T> net) { HoningNode <T> node = net.getHoningNode(seeker); if (node == null) { return; } int clique_size = node.clique.Count; foreach (T k_i in node.clique.Keys) { foreach (T K_j in node.clique.Keys) { int i = getRulerID(k_i); int j = getRulerID(K_j); ruler[i][j] += clique_size / total_internal_nodes; } } }
public void GetRelationsFromEssential(T seed, out Dictionary <T, HoningNode <T> > output) { output = new Dictionary <T, HoningNode <T> >(); if (!network.ContainsKey(seed)) { return; } List <T> bridges = new List <T>(); HoningNode <T> refnode = network[seed]; foreach (T key in refnode.clique.Keys) { if (refnode.clique[key].mark == "essential") { bridges.Add(key); } } recruitNeurds(bridges, out output, "internal"); }
public void seek_by_card(HoningNetwork <String> net, String card_name, int return_count, float threshold, out List <String> result) { // Retorno padr'ao result = null; if (return_count <= 0) { return; } // Preparar output Dictionary <String, HoningNode <String> > output; Dictionary <String, HoningNode <String> > output_spell; Dictionary <String, HoningNode <String> > output_others; // Resultados para uso no site result = new List <String>(); // Preparar entradas da rede de honing HoningNode <String> working_node = net.getHoningNode(card_name); List <String> bridges = new List <String>(); if (working_node == null) { return; } foreach (KeyValuePair <String, HoningNode <String> > key_pair in working_node.clique) { bridges.Add(key_pair.Value.holder); } List <String> spellList = new List <string>(); List <String> minionList = new List <string>(); spellList.Add("spell"); minionList.Add("minion"); // Recrutamento de neurds net.recruitNeurds(bridges, out output);//, spellList); //net.recruitNeurds(bridges, out output_spell, minionList); net.keepWithMicrofeature(ref output, out output_others, "minion"); net.keepWithMicrofeature(ref output, out output_spell, "spell"); // Verifica validade do threshold if (threshold > 1.0f) { threshold = 1.0f; } Random rand_obj = new Random(); HoningNode <String> node = net.getHoningNode("Malygos"); // Prepara'cao final de output para o site while (return_count > 0) { foreach (KeyValuePair <String, HoningNode <String> > key_pair in output) { float rand_prob = (float)rand_obj.NextDouble(); if (rand_prob >= threshold) { result.Add(key_pair.Key); return_count--; break; } } // Fim foreach } // Fim while*/ } // Fim seek_by_card