Example #1
0
        private BidirectionalGraph <Point, Edge <Point> > BuildGraph(HashSet <Point> map)
        {
            var location = map.First();
            var graph    = new QuikGraph.BidirectionalGraph <Point, Edge <Point> >();

            foreach (var point in map)
            {
                graph.AddVertex(point);
            }

            foreach (var point in map)
            {
                foreach (var dir in Enum.GetValues(typeof(Direction)).Cast <Direction>())
                {
                    var target = point.GetPoint(dir);
                    if (map.Contains(target))
                    {
                        graph.AddEdge(new Edge <Point>(point, target));
                    }
                }
            }

            return(graph);
        }