Ejemplo n.º 1
0
 /// <summary>
 /// Construct a new bidirectional dijkstra algorithm. </summary>
 /// <param name="expander">          The <seealso cref="PathExpander"/> to be used to decide which relationships
 ///                          to expand for each node </param>
 /// <param name="costEvaluator">     The <seealso cref="CostEvaluator"/> to be used for calculating cost of a
 ///                          relationship </param>
 /// <param name="epsilon">           The tolerance level to be used when comparing floating point numbers. </param>
 public DijkstraBidirectional(PathExpander expander, CostEvaluator <double> costEvaluator, double epsilon)
 {
     this._expander      = expander;
     this._costEvaluator = costEvaluator;
     this._epsilon       = epsilon;
     this._stateFactory  = InitialBranchState.DOUBLE_ZERO;
 }
Ejemplo n.º 2
0
 internal AsOneStartBranch(TraversalContext context, IEnumerable <Node> nodes, InitialBranchState initialState, UniquenessFactory uniqueness)
 {
     this._context      = context;
     this._initialState = initialState;
     this._uniqueness   = uniqueness;
     this._branches     = ToBranches(nodes);
 }
Ejemplo n.º 3
0
 public Dijkstra(PathExpander expander, InitialBranchState stateFactory, CostEvaluator <double> costEvaluator, bool stopAfterLowestCost)
 {
     this._expander      = expander;
     this._costEvaluator = costEvaluator;
     this._stateFactory  = stateFactory;
     _interest           = stopAfterLowestCost ? PathInterestFactory.allShortest(NoneStrictMath.EPSILON) : PathInterestFactory.all(NoneStrictMath.EPSILON);
     _epsilon            = NoneStrictMath.EPSILON;
     this._stateInUse    = true;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Construct new dijkstra algorithm. </summary>
 /// <param name="expander">          <seealso cref="PathExpander"/> to be used to decide which relationships
 ///                          to expand. </param>
 /// <param name="costEvaluator">     <seealso cref="CostEvaluator"/> to be used to calculate cost of relationship </param>
 /// <param name="epsilon">           The tolerance level to be used when comparing floating point numbers. </param>
 /// <param name="interest">          <seealso cref="PathInterest"/> to be used when deciding if a path is interesting.
 ///                          Recommend to use <seealso cref="PathInterestFactory"/> to get reliable behaviour. </param>
 public Dijkstra(PathExpander expander, CostEvaluator <double> costEvaluator, double epsilon, PathInterest <double> interest)
 {
     this._expander      = expander;
     this._costEvaluator = costEvaluator;
     this._epsilon       = epsilon;
     this._interest      = interest;
     this._stateFactory  = InitialBranchState.DOUBLE_ZERO;
     this._stateInUse    = false;
 }
Ejemplo n.º 5
0
 internal MonoDirectionalTraverserIterator(Resource resource, UniquenessFilter uniqueness, PathExpander expander, BranchOrderingPolicy order, PathEvaluator evaluator, IEnumerable <Node> startNodes, InitialBranchState initialState, UniquenessFactory uniquenessFactory) : base(resource)
 {
     this._uniqueness = uniqueness;
     this._evaluator  = evaluator;
     this._selector   = order.Create(new AsOneStartBranch(this, startNodes, initialState, uniquenessFactory), expander);
 }
Ejemplo n.º 6
0
 public PathExpanderAnonymousInnerClass(DijkstraIncreasingWeightTest outerInstance, InitialBranchState <int> state, IDictionary <Node, int> encounteredState)
 {
     this.outerInstance     = outerInstance;
     this._state            = state;
     this._encounteredState = encounteredState;
 }
Ejemplo n.º 7
0
 internal StartNodeTraversalBranch(TraversalContext context, TraversalBranch parent, Node source, InitialBranchState initialState) : base(parent, source, initialState)
 {
     this._initialState = initialState;
     Evaluate(context);
     context.IsUniqueFirst(this);
 }
Ejemplo n.º 8
0
 public Dijkstra(PathExpander expander, InitialBranchState stateFactory, CostEvaluator <double> costEvaluator) : this(expander, stateFactory, costEvaluator, true)
 {
 }
Ejemplo n.º 9
0
 public static PathFinder <WeightedPath> Dijkstra(PathExpander expander, InitialBranchState stateFactory, string relationshipPropertyRepresentingCost)
 {
     return(dijkstra(expander, stateFactory, new DoubleEvaluator(relationshipPropertyRepresentingCost)));
 }
Ejemplo n.º 10
0
 public static PathFinder <WeightedPath> Dijkstra(PathExpander expander, InitialBranchState stateFactory, CostEvaluator <double> costEvaluator)
 {
     return(new Dijkstra(expander, stateFactory, costEvaluator));
 }
Ejemplo n.º 11
0
 public TraversalBranchWithState(TraversalBranch parent, Node source, InitialBranchState initialState) : base(parent, source)
 {
     this.StateForMe = this.StateForChildren = initialState.initialState(this);
 }