Beispiel #1
0
        void GraphTextBlockClickExecute(object parameter)
        {
            int prevItemsCount = existingVertices.Count;
            PocVertex newRoot = (parameter as PocVertex);

            if ( Graph.Edges.Any(e => e.Source == newRoot) ) return;

            var qualifiedWords = EditDistance.GetShortestLevenshtein(newRoot.word, wordList.Select(w => w.Name).ToList());

            foreach (KeyValuePair<string, int> w in qualifiedWords)
            {
                var tmpVertex = new PocVertex(prevItemsCount++, w.Key, w.Value);
                existingVertices.Add(tmpVertex);
                graph.AddVertex(tmpVertex);
                AddNewGraphEdge(newRoot, tmpVertex);
            }
        }
Beispiel #2
0
        private PocEdge AddNewGraphEdge(PocVertex from, PocVertex to)
        {
            string edgeString = string.Format("{0}-{1} Connected", from.word, to.word);

            PocEdge newEdge = new PocEdge(edgeString, from, to);
            Graph.AddEdge(newEdge);
            return newEdge;
        }