예제 #1
0
 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);
 }
예제 #2
0
        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));
        }
예제 #3
0
 public void AddEdge(GraphEdge edge)
 {
     AddEdge(edge.FromNode, edge.ToNode, edge.Weight);
 }
예제 #4
0
 public GraphRoute AppendToStart(GraphEdge y)
 {
     return(new GraphRoute(new[] { y }.Concat(m_edges)));
 }
예제 #5
0
 public GraphRoute(GraphEdge edge) : this(new[] { edge })
 {
 }