コード例 #1
0
ファイル: GraphEdgeSet.cs プロジェクト: zsmj007/PoESkillTree
        /// <summary>
        /// Creates a new <see cref="GraphEdge"/> with the given parameters and adds it to the set.
        /// </summary>
        public void Add(int n1, int n2, uint weight)
        {
            var edge = new GraphEdge(n1, n2, weight);

            // Assigning with indexer does not override the existing value ...
            _edgeDict.Remove(edge);
            _edgeDict[edge] = edge;
            _adjacencyMatrix[edge.N1].Add(edge.N2);
            _adjacencyMatrix[edge.N2].Add(edge.N1);
        }
コード例 #2
0
ファイル: GraphEdgeSet.cs プロジェクト: zsmj007/PoESkillTree
 /// <summary>
 /// Removes the given edge from the set.
 /// </summary>
 public void Remove(GraphEdge edge)
 {
     _adjacencyMatrix[edge.N1].Remove(edge.N2);
     _adjacencyMatrix[edge.N2].Remove(edge.N1);
     _edgeDict.Remove(edge);
 }