static void ManualBuild() { var seperator = new[] { ' ', '\t' }; var lines = System.IO.File.ReadAllLines(File); var nodes = new TheNode[lines.Length]; var edges = new List<TheEdge>(lines.Length); foreach (var line in lines) { var dataitems = line.Split(seperator, StringSplitOptions.RemoveEmptyEntries); var left = Int32.Parse(dataitems[0]); var right = Int32.Parse(dataitems[1]); if (nodes[left] == null) nodes[left] = new TheNode(left); if (nodes[right] == null) nodes[right] = new TheNode(right); var edge = new TheEdge(nodes[left], nodes[right]); edges.Add(edge); } Console.WriteLine(edges.Count); var finalNodes = new List<TheNode>(nodes.Where(n => n != null)); Console.WriteLine(finalNodes.Count); }
public TheEdge(TheNode left, TheNode right) { Right = right; Left = left; }