Ejemplo n.º 1
0
        public void AddEdge(GraphEdge graphEdge)
        {
            if (AdjacenceyList[graphEdge.Source] == null)
            {
                AdjacenceyList[graphEdge.Source] = new List <GraphNode>();
            }

            AdjacenceyList[graphEdge.Source].Add(new GraphNode(graphEdge.Destination, graphEdge.Cost));
        }
Ejemplo n.º 2
0
        public void RemoveEdge(GraphEdge graphEdge)
        {
            if (AdjacenceyList[graphEdge.Source] == null)
            {
                throw new Exception("Such edge does not exists");
            }
            var removalNode = AdjacenceyList[graphEdge.Source].Find((x) => (x.Destination == graphEdge.Destination) && (x.Cost == graphEdge.Cost));

            AdjacenceyList[graphEdge.Source].Remove(removalNode);
        }