public void AwesomePrint() { Console.Clear(); AllocateNodesCoords(0); char edgeSymbol = ':'; foreach (Node <T> node in Nodes) { foreach (Node <T> incidentNode in node.IncidentNodes) { bool doubleConnected = node.IncidentNodes.Contains(incidentNode) && incidentNode.IncidentNodes.Contains(node); GraphPrinter.DrawEdgeLine(node.ConsoleCoords, incidentNode.ConsoleCoords, edgeSymbol, doubleConnected); } } Func <Node <T>, string> format = (n) => $"[{n.Index.ToString()}]: {n.Value.ToString()}"; foreach (Node <T> node in Nodes) { Point pos = GraphPrinter.GetConsoleCoordsForPlate(node.ConsoleCoords, format(node)); Console.SetCursorPosition(pos.X, pos.Y); Console.Write(format(node)); } Console.SetCursorPosition(0, Console.WindowHeight - 1); Console.Write("Для прожолжения нажмите любую клавишу..."); Console.ReadKey(); Console.Clear(); }
private void AllocateNodesCoords(int flipAngle = 0) { if (Nodes.All(x => x.ConsoleCoords != Point.Empty)) { return; } int nodesCount = Nodes.Count; List <Point> consoleCoords = GraphPrinter.GetConsoleCoords(nodesCount, flipAngle); for (int i = 0; i < nodesCount; i++) { Nodes[i].ConsoleCoords = consoleCoords[i]; } }