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