clean up and refactor half-baked development commits and squash them into a new version.
Changes: * support for multiple GTFS feeds as input in filtering, read default global and local configuration files * be a bit more memory conservative * make caching optional * dont delete orphan edge if it would transform a degree 3 node with a possible full turn into a degree 2 node eligible for contraction * dedicated filters for funicular and gondola * make max snap level option more intuitive * allow filter rules for level 0 * additional fallback for station snapping * dont try to route for MOT unequal to trip in -T mode, force-snap to orphaned OSM station if not snap was possible * write bounds to filtered osm * remove unused surrounding heuristic * use bus lanes info * be a bit more tolerant for bus oneway streets * create missing directories * error if no cfg is present, clean up evaluation Makefile
This commit is contained in:
parent
2cc2d2dc23
commit
63f0b61ea1
60 changed files with 4532 additions and 1576 deletions
33
src/util/graph/Algorithm.h
Normal file
33
src/util/graph/Algorithm.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2017, University of Freiburg,
|
||||
// Chair of Algorithms and Data Structures.
|
||||
// Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de>
|
||||
|
||||
#ifndef UTIL_GRAPH_ALGORITHM_H_
|
||||
#define UTIL_GRAPH_ALGORITHM_H_
|
||||
|
||||
#include <stack>
|
||||
#include "util/graph/Edge.h"
|
||||
#include "util/graph/UndirGraph.h"
|
||||
#include "util/graph/Node.h"
|
||||
|
||||
namespace util {
|
||||
namespace graph {
|
||||
|
||||
using util::graph::Graph;
|
||||
using util::graph::Node;
|
||||
using util::graph::Edge;
|
||||
|
||||
// collection of general graph algorithms
|
||||
class Algorithm {
|
||||
public:
|
||||
template <typename N, typename E>
|
||||
static std::vector<std::set<Node<N, E>*> > connectedComponents(
|
||||
const UndirGraph<N, E>& g);
|
||||
};
|
||||
|
||||
#include "util/graph/Algorithm.tpp"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // UTIL_GRAPH_ALGORITHM_H_
|
||||
32
src/util/graph/Algorithm.tpp
Normal file
32
src/util/graph/Algorithm.tpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2017, University of Freiburg,
|
||||
// Chair of Algorithms and Data Structures.
|
||||
// Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de>
|
||||
|
||||
// _____________________________________________________________________________
|
||||
template <typename N, typename E>
|
||||
std::vector<std::set<Node<N, E>*> > Algorithm::connectedComponents(
|
||||
const UndirGraph<N, E>& g) {
|
||||
std::vector<std::set<Node<N, E>*>> ret;
|
||||
std::set<Node<N, E>*> visited;
|
||||
|
||||
for (auto* n : g.getNds()) {
|
||||
if (!visited.count(n)) {
|
||||
ret.resize(ret.size() + 1);
|
||||
std::stack<Node<N, E>*> q;
|
||||
q.push(n);
|
||||
while (!q.empty()) {
|
||||
Node<N, E>* cur = q.top();
|
||||
q.pop();
|
||||
|
||||
ret.back().insert(cur);
|
||||
visited.insert(cur);
|
||||
|
||||
for (auto* e : cur->getAdjList()) {
|
||||
if (!visited.count(e->getOtherNd(cur))) q.push(e->getOtherNd(cur));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
#define UTIL_GRAPH_DIRNODE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "util/graph/Node.h"
|
||||
|
||||
namespace util {
|
||||
|
|
|
|||
|
|
@ -33,12 +33,15 @@ class Node {
|
|||
virtual void addEdge(Edge<N, E>* e) = 0;
|
||||
virtual void removeEdge(Edge<N, E>* e) = 0;
|
||||
|
||||
virtual ~Node() {};
|
||||
virtual ~Node() = 0;
|
||||
|
||||
virtual N& pl() = 0;
|
||||
virtual const N& pl() const = 0;
|
||||
};
|
||||
|
||||
template <typename N, typename E>
|
||||
inline Node<N, E>::~Node() {}
|
||||
|
||||
}}
|
||||
|
||||
#endif // UTIL_GRAPH_NODE_H_
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#define UTIL_GRAPH_UNDIRNODE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "util/graph/Node.h"
|
||||
|
||||
namespace util {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue