/// <summary> /// Set relations between two nodes /// </summary> /// <param name="node"></param> /// <param name="price"></param> /// <param name="reverse"></param> private void SetRelations(int node, int price, bool reverse) { Stack <int> relatedNodes; relatedNodes = PositionTools.getRelatedPositions(node, WidthAndHeight); while (relatedNodes.Count > 0) { if (!reverse) { Graph.SetRelationShip(node, relatedNodes.Pop(), price); } else { Graph.SetRelationShip(relatedNodes.Pop(), node, price); } } }