コード例 #1
0
        public void AddVertex(long id, T data)
        {
            if (AllVertex.ContainsKey(id))
            {
                return;
            }

            Vertex <T> v = new Vertex <T>(id, data);

            AllVertex.Add(id, v);

            NumberOfVertices++;
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vertex"></param>
        public void AddVertex(Vertex <T> vertex)
        {
            if (AllVertex.ContainsKey(vertex.Id))
            {
                return;
            }

            AllVertex.Add(vertex.Id, vertex);

            foreach (var e in vertex.GetAdjEdges())
            {
                AllEdges.Add(e);
                NumberOfEdges++;
            }

            NumberOfVertices++;
        }