public bool AddUndirectedEdge(T from, T to) { bool result = false; GraphNode <T> fromNode = nodeSet.FindByValue(from) as GraphNode <T>; GraphNode <T> toNode = nodeSet.FindByValue(to) as GraphNode <T>; if (fromNode != null && toNode != null) { result = true; AddUndirectedEdge(fromNode, toNode); } return(result); }
/// <summary> /// Adiciona uma aresta direcionada no grafo sem custo /// </summary> /// <param name="from"></param> /// <param name="to"></param> public void AddDirectedEdge(T from, T to, int d) { AddDirectedEdge(nodeSet.FindByValue(from), nodeSet.FindByValue(to), d); }
public void AddDirectedEdge(T from, T to) { nodeSet.FindByValue(from).Neighbors.Add(nodeSet.FindByValue(to)); }
public bool Contains(T value) { return(nodeSet.FindByValue(value) != null); }
public void AddDirectedEdge(T from, T to, float cost) { AddDirectedEdge((GraphNode <T>)nodeSet.FindByValue(from), (GraphNode <T>)nodeSet.FindByValue(to), cost); }
/// <summary> /// Adds a directed edge from a GraphNode with one value (from) to a GraphNode with another value (to) /// with an associated cost. /// </summary> /// <param name="from">The value of the GraphNode from which the directed edge eminates.</param> /// <param name="to">The value of the GraphNode to which the edge leads.</param> /// <param name="cost">The cost of the edge from "from" to "to".</param> public void AddDirectedEdge(T from, T to, int cost) { ((GraphNode <T>)nodeSet.FindByValue(from)).Neighbors.Add(nodeSet.FindByValue(to)); ((GraphNode <T>)nodeSet.FindByValue(from)).Costs.Add(cost); }