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