private static bool CheckEdges(GraphEdge edgeAlpha, IEnumerable <GraphEdge> inList) { foreach (var edge in inList) { if (edge.To == edgeAlpha.To && edge.From == edgeAlpha.From) { return(true); } if (edge.From == edgeAlpha.To && edge.To == edgeAlpha.From) { return(true); } } return(false); }
static void AddNodeToList(int alpha, int beta, int triangle) { var graphEdge = new GraphEdge(alpha, beta, Vector3.Distance(Nodes[alpha].Position, Nodes[beta].Position), triangle); var bDoesContain = false; var nodeToUse = alpha; foreach (var edge in Nodes[alpha].AdjacencyList) { if (!(edge.To == graphEdge.To && edge.From == graphEdge.From)) { continue; } bDoesContain = true; break; } if (!bDoesContain) { Nodes[alpha].AdjacencyList.Add(graphEdge); } }