public AssociationsResult(HashSet <MSGF> startNodes, MsgfGraph msgfGraph, uint targetDistance = 3) { StartNodes = startNodes; MsgfGraph = msgfGraph; TargetDistance = targetDistance; TotalUpdates = 0; foreach (var node in MsgfGraph.GetAllNodes()) { NodesProbability.Add(node, 0); } }
public Dictionary <string, double> FingUsecases(uint count = 10) { Dictionary <string, double> ret = new Dictionary <string, double>(); foreach (var node in ProbabilityGraph.GetAllNodes()) { double x = (double)NodesProbability[node]; if (ret.Any()) { double min = ret.Min(pair => pair.Value); if (min < x) { if (ret.Count() >= count) { ret.Remove(ret.First(pair => Math.Abs(pair.Value - min) < 2 * Double.Epsilon).Key); } ret.Add(node.GetContent(), x); } } else { ret.Add(node.GetContent(), x); } foreach (var outgoingNode in ProbabilityGraph.GetOutgoingNodes(node)) { var tempOutgoingX = x * ProbabilityGraph.GetEdgeFreq(node, outgoingNode) * NodesProbability[outgoingNode]; double outgoingX = Math.Pow(tempOutgoingX, 1.0 / 3.0); if (ret.Any()) { double min = ret.Min(pair => pair.Value); if (min < outgoingX) { if (ret.Count() >= count) { ret.Remove(ret.First(pair => Math.Abs(pair.Value - min) < 2 * Double.Epsilon).Key); } ret.Add(node.GetContent() + "," + outgoingNode.GetContent(), outgoingX); } } else { ret.Add(node.GetContent() + "," + outgoingNode.GetContent(), outgoingX); } foreach (var outgoingNode2 in ProbabilityGraph.GetOutgoingNodes(outgoingNode)) { var tempOutgoingX2 = tempOutgoingX * ProbabilityGraph.GetEdgeFreq(outgoingNode, outgoingNode2) * NodesProbability[outgoingNode2]; double outgoingX2 = Math.Pow(tempOutgoingX2, 1.0 / 5.0); if (ret.Any()) { double min = ret.Min(pair => pair.Value); if (min < outgoingX2) { if (ret.Count() >= count) { ret.Remove(ret.First(pair => Math.Abs(pair.Value - min) < 2 * Double.Epsilon).Key); } ret.Add(node.GetContent() + "," + outgoingNode.GetContent() + "," + outgoingNode2.GetContent(), outgoingX2); } } else { ret.Add(node.GetContent() + "," + outgoingNode.GetContent() + "," + outgoingNode2.GetContent(), outgoingX2); } } } } return(ret); }