Пример #1
0
        public void AddEdge(string name1, string name2, int length)
        {
            if (list.Contains(name1) && list.Contains(name2))
            {
                Vertex first  = list.GetVertex(name1);
                Vertex second = list.GetVertex(name2);

                if (list[first, second] == null)
                {
                    Edge edge = new Edge(second, length);
                    list.AddLink(first, edge);
                }
            }
            else
            {
                throw new VertexDoesNotExistException();
            }
        }