1
0
Fork 0

Reenabled ShortestPath with AttributeWeight. Was accidentially disabled by options modifications.

This commit is contained in:
Michael Hackstein 2017-04-12 09:05:54 +02:00
parent c2be40b4ab
commit 7469cc7bec
3 changed files with 9 additions and 5 deletions

View File

@ -250,7 +250,7 @@ ShortestPathBlock::ShortestPathBlock(ExecutionEngine* engine,
_path = std::make_unique<arangodb::traverser::ShortestPath>();
if (arangodb::ServerState::instance()->isCoordinator()) {
if (_opts->useWeight) {
if (_opts->useWeight()) {
_finder.reset(new arangodb::graph::AttributeWeightShortestPathFinder(
EdgeWeightExpanderCluster(this, false),
EdgeWeightExpanderCluster(this, true), _opts->bidirectional));
@ -259,7 +259,7 @@ ShortestPathBlock::ShortestPathBlock(ExecutionEngine* engine,
new arangodb::graph::ConstantWeightShortestPathFinder(this));
}
} else {
if (_opts->useWeight) {
if (_opts->useWeight()) {
_finder.reset(new arangodb::graph::AttributeWeightShortestPathFinder(
EdgeWeightExpanderLocal(this, false),
EdgeWeightExpanderLocal(this, true), _opts->bidirectional));

View File

@ -35,7 +35,6 @@ using namespace arangodb::graph;
ShortestPathOptions::ShortestPathOptions(transaction::Methods* trx)
: BaseOptions(trx),
direction("outbound"),
useWeight(false),
weightAttribute(""),
defaultWeight(1),
bidirectional(true),
@ -45,7 +44,6 @@ ShortestPathOptions::ShortestPathOptions(transaction::Methods* trx,
VPackSlice const& info)
: BaseOptions(trx),
direction("outbound"),
useWeight(false),
weightAttribute(""),
defaultWeight(1),
bidirectional(true),
@ -85,6 +83,10 @@ VPackSlice ShortestPathOptions::getStart() const {
VPackSlice ShortestPathOptions::getEnd() const { return endBuilder.slice(); }
bool ShortestPathOptions::useWeight() const {
return !weightAttribute.empty();
}
void ShortestPathOptions::toVelocyPack(VPackBuilder& builder) const {
VPackObjectBuilder guard(&builder);
builder.add("weightAttribute", VPackValue(weightAttribute));

View File

@ -42,7 +42,6 @@ struct ShortestPathOptions : public BaseOptions {
public:
std::string start;
std::string direction;
bool useWeight;
std::string weightAttribute;
double defaultWeight;
bool bidirectional;
@ -68,6 +67,9 @@ struct ShortestPathOptions : public BaseOptions {
arangodb::velocypack::Slice getStart() const;
arangodb::velocypack::Slice getEnd() const;
/// @brief Test if we have to use a weight attribute
bool useWeight() const;
/// @brief Build a velocypack for cloning in the plan.
void toVelocyPack(arangodb::velocypack::Builder&) const override;