public bool TryGetEdge(string from, string to, out GraphEdge edge) { edge = null; if (!NodeExists(from) || !NodeExists(to)) { return(false); } edge = m_nodes[from].FirstOrDefault(x => x.ToNode == to); return(edge != null); }
public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } GraphEdge other = (GraphEdge)obj; return((FromNode == other.FromNode) && (ToNode == other.ToNode)); }
public void AddEdge(GraphEdge edge) { AddEdge(edge.FromNode, edge.ToNode, edge.Weight); }
public GraphRoute AppendToStart(GraphEdge y) { return(new GraphRoute(new[] { y }.Concat(m_edges))); }
public GraphRoute(GraphEdge edge) : this(new[] { edge }) { }