Esempio n. 1
0
 public WeightedPathIterator(ResourceIterator <Path> paths, CostEvaluator <double> costEvaluator, double epsilon, PathInterest interest)
 {
     this._paths         = paths;
     this._costEvaluator = costEvaluator;
     this._epsilon       = epsilon;
     this._interest      = interest;
 }
Esempio n. 2
0
 public TestBestFirstSelectorFactory(PathExpander expander, PathInterest <int> interest, Uniqueness uniqueness, string[] expectedResult)
 {
     this._expander       = expander;
     this._uniqueness     = uniqueness;
     this._expectedResult = expectedResult;
     _factory             = new BestFirstSelectorFactoryAnonymousInnerClass(this, interest);
 }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private org.neo4j.graphdb.traversal.Traverser traverser(org.neo4j.graphdb.Node start, final org.neo4j.graphdb.Node end, org.neo4j.graphalgo.impl.util.PathInterest interest)
        private Traverser Traverser(Node start, Node end, PathInterest interest)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.commons.lang3.mutable.MutableDouble shortestSoFar = new org.apache.commons.lang3.mutable.MutableDouble(Double.MAX_VALUE);
            MutableDouble shortestSoFar = new MutableDouble(double.MaxValue);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.commons.lang3.mutable.MutableDouble startSideShortest = new org.apache.commons.lang3.mutable.MutableDouble(0);
            MutableDouble startSideShortest = new MutableDouble(0);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.commons.lang3.mutable.MutableDouble endSideShortest = new org.apache.commons.lang3.mutable.MutableDouble(0);
            MutableDouble endSideShortest  = new MutableDouble(0);
            PathExpander  dijkstraExpander = new DijkstraBidirectionalPathExpander(_expander, shortestSoFar, true, startSideShortest, endSideShortest, _epsilon);

            GraphDatabaseService db = start.GraphDatabase;

            TraversalDescription side = Db.traversalDescription().expand(dijkstraExpander, _stateFactory).order(new DijkstraSelectorFactory(interest, _costEvaluator)).evaluator(new DijkstraBidirectionalEvaluator(_costEvaluator)).uniqueness(Uniqueness.NODE_PATH);

            TraversalDescription startSide = side;
            TraversalDescription endSide   = side.Reverse();

            BidirectionalTraversalDescription traversal = Db.bidirectionalTraversalDescription().startSide(startSide).endSide(endSide).collisionEvaluator(Evaluators.all()).collisionPolicy((evaluator, pathPredicate) => new DijkstraBranchCollisionDetector(evaluator, _costEvaluator, shortestSoFar, _epsilon, pathPredicate));

            _lastTraverser = traversal.Traverse(start, end);
            return(_lastTraverser);
        }
Esempio n. 4
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;
 }
Esempio n. 5
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;
 }
Esempio n. 6
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private org.neo4j.graphdb.traversal.Traverser traverser(org.neo4j.graphdb.Node start, final org.neo4j.graphdb.Node end, org.neo4j.graphalgo.impl.util.PathInterest<double> interest)
        private Traverser Traverser(Node start, Node end, PathInterest <double> interest)
        {
            PathExpander  dijkstraExpander;
            PathEvaluator dijkstraEvaluator;

            if (_stateInUse)
            {
                dijkstraExpander  = _expander;
                dijkstraEvaluator = Evaluators.includeWhereEndNodeIs(end);
            }
            else
            {
                MutableDouble shortestSoFar = new MutableDouble(double.MaxValue);
                dijkstraExpander  = new DijkstraPathExpander(_expander, shortestSoFar, _epsilon, interest.StopAfterLowestCost());
                dijkstraEvaluator = new DijkstraEvaluator(shortestSoFar, end, _costEvaluator);
            }
            _lastTraverser = (new MonoDirectionalTraversalDescription()).uniqueness(Uniqueness.NODE_PATH).expand(dijkstraExpander, _stateFactory).order(new DijkstraSelectorFactory(interest, _costEvaluator)).evaluator(dijkstraEvaluator).traverse(start);
            return(_lastTraverser);
        }
Esempio n. 7
0
 public DijkstraSelectorFactory(PathInterest <double> interest, CostEvaluator <double> evaluator) : base(interest)
 {
     this._evaluator = evaluator;
 }
Esempio n. 8
0
 public BestFirstSelectorFactory(PathInterest <P> interest)
 {
     this._interest = interest;
 }
Esempio n. 9
0
 internal SelectorFactory(TraversalAStar outerInstance, Node end, PathInterest interest) : base(interest)
 {
     this._outerInstance = outerInstance;
     this.End            = end;
 }
Esempio n. 10
0
 /// <summary>
 /// See <seealso cref="Dijkstra(PathExpander, CostEvaluator, double, PathInterest)"/>
 /// Use <seealso cref="NoneStrictMath.EPSILON"/> as tolerance.
 /// </summary>
 public Dijkstra(PathExpander expander, CostEvaluator <double> costEvaluator, PathInterest <double> interest) : this(expander, costEvaluator, NoneStrictMath.EPSILON, interest)
 {
 }