Esempio n. 1
0
        internal void CalculateScores()
        {
            FirstFuncNodesAndEdges  = GraphCreator.CompileCode(FirstFunctionCode);
            SecondFuncNodesAndEdges = GraphCreator.CompileCode(SecondFunctionCode);

            PairingFirstToSecond = GraphSimilarityCalc.GetDistance(FirstFuncNodesAndEdges.Nodes, SecondFuncNodesAndEdges.Nodes);
            PairingSecondToFirst = GraphSimilarityCalc.GetDistance(SecondFuncNodesAndEdges.Nodes, FirstFuncNodesAndEdges.Nodes);

            ScoreFirstContainedInSecond = Math.Round(PairingFirstToSecond.TotalScore / PairingFirstToSecond.SourceSelfPairings.TotalScore, 2);
            ScoreSecondContainedInFirst = Math.Round(PairingSecondToFirst.TotalScore / PairingSecondToFirst.SourceSelfPairings.TotalScore, 2);

            ScoreTwoWay = (PairingFirstToSecond.TotalScore + PairingSecondToFirst.TotalScore) / (PairingSecondToFirst.SourceSelfPairings.TotalScore + PairingFirstToSecond.SourceSelfPairings.TotalScore);
            ScoreTwoWay = Math.Round(ScoreTwoWay.Value, 2);
        }
Esempio n. 2
0
        private static double GetContainedScore(List <InstructionNode> Graph1, List <InstructionNode> Graph2, bool twoWayScore)
        {
            NodePairings pairing1 = GraphSimilarityCalc.GetDistance(Graph1, Graph2);

            double Graph1ContainedIn2Score = pairing1.TotalScore / pairing1.SourceSelfPairings.TotalScore;

            if (twoWayScore)
            {
                NodePairings pairing2          = GraphSimilarityCalc.GetDistance(Graph2, Graph1);
                double       totalScoreAverage = (pairing1.TotalScore + pairing2.TotalScore) / (pairing1.SourceSelfPairings.TotalScore + pairing1.ImageSelfPairings.TotalScore);
                return(totalScoreAverage);
            }
            else
            {
                return(Graph1ContainedIn2Score);
            }
        }