/// <summary> /// Creates a new weight-matrix algorithm. /// </summary> public DirectedWeightMatrixAlgorithm(RouterBase router, IProfileInstance profile, WeightHandler <T> weightHandler, IMassResolvingAlgorithm massResolver, T?max = null) { _router = router; _profile = profile; _weightHandler = weightHandler; _massResolver = massResolver; ContractedDb contractedDb; if (!router.Db.TryGetContracted(profile.Profile, out contractedDb)) { throw new NotSupportedException( "Contraction-based many-to-many calculates are not supported in the given router db for the given profile."); } if (!contractedDb.HasEdgeBasedGraph) { throw new NotSupportedException( "Contraction-based edge-based many-to-many calculates are not supported in the given router db for the given profile."); } _graph = contractedDb.EdgeBasedGraph; weightHandler.CheckCanUse(contractedDb); if (max.HasValue) { _max = max.Value; } else { _max = weightHandler.Infinite; } _buckets = new Dictionary <uint, Dictionary <int, LinkedEdgePath <T> > >(); }
/// <summary> /// Creates a new algorithm. /// </summary> public ManyToManyWeightsBidirectionalDykstra(RouterDb routerDb, Profile profile, WeightHandler <T> weightHandler, RouterPoint[] sources, RouterPoint[] targets, T max) { _routerDb = routerDb; _weightHandler = weightHandler; _sources = sources; _targets = targets; _profile = profile; _max = max; ContractedDb contractedDb; if (!_routerDb.TryGetContracted(profile, out contractedDb)) { throw new NotSupportedException( "Contraction-based many-to-many calculates are not supported in the given router db for the given profile."); } if (!contractedDb.HasEdgeBasedGraph) { throw new NotSupportedException( "Contraction-based edge-based many-to-many calculates are not supported in the given router db for the given profile."); } _graph = contractedDb.EdgeBasedGraph; weightHandler.CheckCanUse(contractedDb); _buckets = new Dictionary <uint, Dictionary <int, T> >(); }
/// <summary> /// Creates a new graph builder. /// </summary> public DirectedGraphBuilder(Itinero.Graphs.Graph source, DirectedDynamicGraph target, WeightHandler <T> weightHandler) { weightHandler.CheckCanUse(target); _source = source; _target = target; _weightHandler = weightHandler; }
/// <summary> /// Creates a new contracted bidirectional router. /// </summary> public BidirectionalDykstra(DirectedMetaGraph graph, WeightHandler <T> weightHandler, IEnumerable <EdgePath <T> > sources, IEnumerable <EdgePath <T> > targets) { weightHandler.CheckCanUse(graph); _graph = graph; _sources = sources; _targets = targets; _weightHandler = weightHandler; }
/// <summary> /// Creates a new contracted bidirectional router. /// </summary> public BidirectionalDykstra(DirectedMetaGraph graph, WeightHandler <T> weightHandler, DykstraSource <T> source, DykstraSource <T> target) { weightHandler.CheckCanUse(graph); _graph = graph; _source = source; _target = target; _weightHandler = weightHandler; }
/// <summary> /// Creates a new routing algorithm instance. /// </summary> public Dykstra(DirectedMetaGraph graph, WeightHandler <T> weightHandler, IEnumerable <EdgePath <T> > sources, bool backward) { weightHandler.CheckCanUse(graph); _graph = graph; _sources = sources; _backward = backward; _weightHandler = weightHandler; }
/// <summary> /// Creates a new hierarchy builder. /// </summary> public HierarchyBuilder(DirectedMetaGraph graph, IPriorityCalculator priorityCalculator, IWitnessCalculator witnessCalculator, WeightHandler <T> weightHandler) { weightHandler.CheckCanUse(graph); _graph = graph; _priorityCalculator = priorityCalculator; _witnessCalculator = witnessCalculator; _weightHandler = weightHandler; }
/// <summary> /// Creates a new routing algorithm instance. /// </summary> public Dykstra(DirectedMetaGraph graph, WeightHandler <T> weightHandler, DykstraSource <T> source, bool backward, T max) { weightHandler.CheckCanUse(graph); _graph = graph; _source = source; _backward = backward; _weightHandler = weightHandler; _max = max; }
/// <summary> /// Creates a new hierarchy builder. /// </summary> public HierarchyBuilder(DirectedDynamicGraph graph, IPriorityCalculator priorityCalculator, IWitnessCalculator <T> witnessCalculator, WeightHandler <T> weightHandler, Func <uint, IEnumerable <uint[]> > getRestrictions) { weightHandler.CheckCanUse(graph); _graph = graph; _priorityCalculator = priorityCalculator; _witnessCalculator = witnessCalculator; _getRestrictions = getRestrictions; _weightHandler = weightHandler; }
/// <summary> /// Creates a new routing algorithm instance. /// </summary> public Dykstra(DirectedDynamicGraph graph, WeightHandler <T> weightHandler, IEnumerable <EdgePath <T> > sources, Func <uint, IEnumerable <uint[]> > getRestrictions, bool backward) { weightHandler.CheckCanUse(graph); _graph = graph; _getRestrictions = getRestrictions; _sources = sources.Select(x => { x.StripEdges(); return(x); }); _backward = backward; _weightHandler = weightHandler; }
/// <summary> /// Creates a new hierarchy builder. /// </summary> public FastHierarchyBuilder(DirectedMetaGraph graph, WeightHandler <T> weightHandler) { weightHandler.CheckCanUse(graph); _graph = graph; _weightHandler = weightHandler; _vertexInfo = new VertexInfo <T>(); _depth = new Dictionary <long, int>(); _contractionCount = new Dictionary <uint, int>(); this.DifferenceFactor = 4; this.DepthFactor = 14; this.ContractedFactor = 1; }
/// <summary> /// Creates a new contracted bidirectional router. /// </summary> public BidirectionalDykstra(DirectedDynamicGraph graph, WeightHandler <T> weightHandler, IEnumerable <EdgePath <T> > sources, IEnumerable <EdgePath <T> > targets, Func <uint, IEnumerable <uint[]> > getRestrictions) { weightHandler.CheckCanUse(graph); _graph = graph; _weightHandler = weightHandler; _sources = sources.Select(x => { x.StripEdges(); return(x); }); _targets = targets.Select(x => { x.StripEdges(); return(x); }); _getRestrictions = getRestrictions; }
/// <summary> /// Creates a new hierarchy builder. /// </summary> public HierarchyBuilder(DirectedMetaGraph graph, DykstraWitnessCalculator <T> witnessCalculator, WeightHandler <T> weightHandler) { weightHandler.CheckCanUse(graph); _graph = graph; _witnessCalculator = witnessCalculator; _weightHandler = weightHandler; _vertexInfo = new VertexInfo <T>(); _depth = new Dictionary <long, int>(); _contractionCount = new Dictionary <uint, int>(); this.DifferenceFactor = 5; this.DepthFactor = 5; this.ContractedFactor = 8; }