public IGraph Build()
        {
            var lines = File.ReadAllLines(_file);

            var nodes = new Node[lines.Length + 1]; //+1 since nodes are 1 based
            var edges = new List<Edge>(lines.Length);
            var edgeId = 0;

            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 Node(left);
                if (nodes[right] == null) nodes[right] = new Node(right);

                nodes[left].Outgoing.Add(nodes[right]);
                nodes[right].Incoming.Add(nodes[left]);

                var edge = new Edge(++edgeId, nodes[left], nodes[right], EdgeDirection.LeftToRight);
                edges.Add(edge);
            }

            var finalNodes = new List<Node>(nodes.Where(n => n != null));
            return new Graph2(finalNodes, edges);
        }
        public IGraph Build()
        {
            var lines = File.ReadAllLines(_file);

            var nodes = new Node[lines.Length + 1]; //since nodes are 1 based
            var edges = new List<Edge>();
            var edgeId = 0;

            foreach (var line in lines)
            {
                var dataitems = line.Split(_seperator, StringSplitOptions.RemoveEmptyEntries);

                var label = Int32.Parse(dataitems[0]);

                var left = nodes[label];
                if (left == null)
                {
                    left = new Node(label);
                    nodes[label] = left;
                }

                foreach (var item in dataitems.Skip(1))
                {
                    var values = item.Split(_edgeSeperator);

                    var itemLabel = Int32.Parse(values[0]);
                    var itemWeight = Int32.Parse(values[1]);

                    var right = nodes[itemLabel];
                    if (right == null)
                    {
                        right = new Node(itemLabel);
                        nodes[itemLabel] = right;
                    }

                    //undirected, no paralle, so no need to add edge if left > right as it should already be added
                    if (left.Label > right.Label) continue;

                    var edge = new Edge(++edgeId, left, right, EdgeDirection.None, itemWeight);
                    edges.Add(edge);
                }
            }

            var finalNodes = nodes.Where(n => n != null).ToList();
            return new Graph(finalNodes, edges);
        }
        public IGraph Build()
        {
            var lines = File.ReadAllLines(_file).Skip(1).ToArray(); //skip comment line
            var countData = lines[0].Split(_seperator, StringSplitOptions.RemoveEmptyEntries);
            var size = Int32.Parse(countData[0]);

            var nodes = new Node[2*size + 1]; //+1 for 1-based index, *2 for neg values

            var edges = new List<Edge>(2*size);
            var edgeId = 0;

            foreach (var line in lines.Skip(1)) //skip size line
            {
                var data = line.Split(_seperator, StringSplitOptions.RemoveEmptyEntries);
                var leftNodeId = Int32.Parse(data[0]);
                var rightNodeId = Int32.Parse(data[1]);

                var leftNodeId1 = -leftNodeId;
                var rightNodeId1 = rightNodeId;

                var leftNodeId2 = -rightNodeId;
                var rightNodeId2 = leftNodeId;

                ////////////////////////////////////
                //left node 1
                var leftIndex1 = (leftNodeId1 < 0) ? (size - leftNodeId1) : leftNodeId1;

                var leftNode1 = nodes[leftIndex1];
                if (leftNode1 == null)
                {
                    leftNode1 = new Node(leftNodeId1);
                    nodes[leftIndex1] = leftNode1;
                }

                ////////////////////////////////////
                //left node 2
                var leftIndex2 = (leftNodeId2 < 0) ? (size - leftNodeId2) : leftNodeId2;

                var leftNode2 = nodes[leftIndex2];
                if (leftNode2 == null)
                {
                    leftNode2 = new Node(leftNodeId2);
                    nodes[leftIndex2] = leftNode2;
                }

                ////////////////////////////////////
                //right node 1
                var rightIndex1 = (rightNodeId1 < 0) ? (size - rightNodeId1) : rightNodeId1;

                var rightNode1 = nodes[rightIndex1];
                if (rightNode1 == null)
                {
                    rightNode1 = new Node(rightNodeId1);
                    nodes[rightIndex1] = rightNode1;
                }

                ////////////////////////////////////
                //right node 1
                var rightIndex2 = (rightNodeId2 < 0) ? (size - rightNodeId2) : rightNodeId2;

                var rightNode2 = nodes[rightIndex2];
                if (rightNode2 == null)
                {
                    rightNode2 = new Node(rightNodeId2);
                    nodes[rightIndex2] = rightNode2;
                }

                leftNode1.Outgoing.Add(rightNode1);
                rightNode1.Incoming.Add(leftNode1);
                leftNode2.Outgoing.Add(rightNode2);
                rightNode2.Incoming.Add(leftNode2);

                var edge1 = new Edge(++edgeId, leftNode1, rightNode1, EdgeDirection.LeftToRight);
                var edge2 = new Edge(++edgeId, leftNode2, rightNode2, EdgeDirection.LeftToRight);
                edges.Add(edge1);
                edges.Add(edge2);
            }

            var finalNodes = nodes.Where(n => n != null).ToList();
            return new Graph2(finalNodes, edges);
        }