private void AddNeighboursToGraph(AdjacencyList <Vertex2D> graph, int x, int y) { var node = new Vertex2D(x, y); var neighbours = GetLocationNeighbours(node); graph.AddNode(node); foreach (var element in neighbours) { graph.AddNeighbour(node, new Node <Vertex2D>(element, 1)); } }