示例#1
0
        public List <int> GetPreviousNeighboursColors(Vertice vertice)
        {
            List <int> neighboursColors = new List <int>();

            foreach (int neighbours in vertice.Neighbours)
            {
                if (neighbours < vertice.Number)
                {
                    Vertice neighbourVertice = vertices.Find(x => x.Number == neighbours);
                    if (neighbourVertice != null)
                    {
                        if (!neighboursColors.Contains(neighbourVertice.Color))
                        {
                            neighboursColors.Add(neighbourVertice.Color);
                        }
                    }
                }
            }
            return(neighboursColors);
        }
示例#2
0
 public double CalculateDistance(MouseEventArgs mouse, Vertice vertice)
 {
     return(Math.Sqrt(Math.Pow(vertice.X - mouse.X, 2) + Math.Pow(vertice.Y - mouse.Y, 2)));
 }
示例#3
0
 public void AddEdge(Vertice vertice1, Vertice vertice2)
 {
     vertice1.Neighbours.Add(vertice2.Number);
     vertice2.Neighbours.Add(vertice1.Number);
 }
示例#4
0
 public void AddVertice(Vertice vertice)
 {
     vertices.Add(vertice);
 }