/// <summary> /// Constructor /// </summary> /// <param name="traceID">Trace id</param> /// <param name="pdg">Program dependency graph</param> /// <param name="config">Configuration object</param> public PageRankScript(string traceID, PDG pdg, PageRankConfig config) : base() { _pdg = pdg; _config = config; _traceID = traceID; }
/// <summary> /// Constructor /// </summary> /// <param name="traceID">Trace id</param> /// <param name="pdg">Program dependency graph</param> /// <param name="config">Configuration object</param> public HITSScript(string traceID, PDG pdg, HITSConfig config) : base() { _pdg = pdg; _config = config; _traceID = traceID; }
/// <summary> /// Deep copy constructor for PDG /// </summary> /// <param name="pdg">Original PDG</param> /// <returns>New PDG</returns> public static PDG DeepCopy(PDG pdg) { PDG pdgCopy = new PDG(); pdgCopy._nodes = new SerializableDictionary <string, PDGNode>(); foreach (KeyValuePair <string, PDGNode> kvpNode in pdg._nodes) { PDGNode nodeCopy = new PDGNode(kvpNode.Value.MethodName); foreach (PDGEdge edge in kvpNode.Value.OutgoingEdges) { nodeCopy.SetEdgeWeight(edge.OutgoingNodeID, edge.Weight); } pdgCopy.Add(nodeCopy); } return(pdgCopy); }
/// <summary> /// Converts a BiGramCollection to a PDG /// </summary> /// <param name="bigrams"></param> /// <returns>PDG</returns> public static PDG Convert(BiGramCollection bigrams) { PDG pdg = new PDG(); foreach (BiGram bigram in bigrams) { if (!pdg._nodes.ContainsKey(bigram.Caller)) { pdg.Add(new PDGNode(bigram.Caller)); } pdg._nodes[bigram.Caller].AddChild(bigram.Callee); if (!pdg._nodes.ContainsKey(bigram.Callee)) pdg.Add(new PDGNode(bigram.Callee)); } return pdg; }
/// <summary> /// Converts a BiGramCollection to a PDG /// </summary> /// <param name="bigrams"></param> /// <returns>PDG</returns> public static PDG Convert(BiGramCollection bigrams) { PDG pdg = new PDG(); foreach (BiGram bigram in bigrams) { if (!pdg._nodes.ContainsKey(bigram.Caller)) { pdg.Add(new PDGNode(bigram.Caller)); } pdg._nodes[bigram.Caller].AddChild(bigram.Callee); if (!pdg._nodes.ContainsKey(bigram.Callee)) { pdg.Add(new PDGNode(bigram.Callee)); } } return(pdg); }
/// <summary> /// Deep copy constructor for PDG /// </summary> /// <param name="pdg">Original PDG</param> /// <returns>New PDG</returns> public static PDG DeepCopy(PDG pdg) { PDG pdgCopy = new PDG(); pdgCopy._nodes = new SerializableDictionary<string,PDGNode>(); foreach (KeyValuePair<string, PDGNode> kvpNode in pdg._nodes) { PDGNode nodeCopy = new PDGNode(kvpNode.Value.MethodName); foreach (PDGEdge edge in kvpNode.Value.OutgoingEdges) { nodeCopy.SetEdgeWeight(edge.OutgoingNodeID, edge.Weight); } pdgCopy.Add(nodeCopy); } return pdgCopy; }