示例#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 })
 {
 }