mirror of https://gitee.com/bigwinds/arangodb
Reenabled ShortestPath with AttributeWeight. Was accidentially disabled by options modifications.
This commit is contained in:
parent
c2be40b4ab
commit
7469cc7bec
|
@ -250,7 +250,7 @@ ShortestPathBlock::ShortestPathBlock(ExecutionEngine* engine,
|
||||||
_path = std::make_unique<arangodb::traverser::ShortestPath>();
|
_path = std::make_unique<arangodb::traverser::ShortestPath>();
|
||||||
|
|
||||||
if (arangodb::ServerState::instance()->isCoordinator()) {
|
if (arangodb::ServerState::instance()->isCoordinator()) {
|
||||||
if (_opts->useWeight) {
|
if (_opts->useWeight()) {
|
||||||
_finder.reset(new arangodb::graph::AttributeWeightShortestPathFinder(
|
_finder.reset(new arangodb::graph::AttributeWeightShortestPathFinder(
|
||||||
EdgeWeightExpanderCluster(this, false),
|
EdgeWeightExpanderCluster(this, false),
|
||||||
EdgeWeightExpanderCluster(this, true), _opts->bidirectional));
|
EdgeWeightExpanderCluster(this, true), _opts->bidirectional));
|
||||||
|
@ -259,7 +259,7 @@ ShortestPathBlock::ShortestPathBlock(ExecutionEngine* engine,
|
||||||
new arangodb::graph::ConstantWeightShortestPathFinder(this));
|
new arangodb::graph::ConstantWeightShortestPathFinder(this));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_opts->useWeight) {
|
if (_opts->useWeight()) {
|
||||||
_finder.reset(new arangodb::graph::AttributeWeightShortestPathFinder(
|
_finder.reset(new arangodb::graph::AttributeWeightShortestPathFinder(
|
||||||
EdgeWeightExpanderLocal(this, false),
|
EdgeWeightExpanderLocal(this, false),
|
||||||
EdgeWeightExpanderLocal(this, true), _opts->bidirectional));
|
EdgeWeightExpanderLocal(this, true), _opts->bidirectional));
|
||||||
|
|
|
@ -35,7 +35,6 @@ using namespace arangodb::graph;
|
||||||
ShortestPathOptions::ShortestPathOptions(transaction::Methods* trx)
|
ShortestPathOptions::ShortestPathOptions(transaction::Methods* trx)
|
||||||
: BaseOptions(trx),
|
: BaseOptions(trx),
|
||||||
direction("outbound"),
|
direction("outbound"),
|
||||||
useWeight(false),
|
|
||||||
weightAttribute(""),
|
weightAttribute(""),
|
||||||
defaultWeight(1),
|
defaultWeight(1),
|
||||||
bidirectional(true),
|
bidirectional(true),
|
||||||
|
@ -45,7 +44,6 @@ ShortestPathOptions::ShortestPathOptions(transaction::Methods* trx,
|
||||||
VPackSlice const& info)
|
VPackSlice const& info)
|
||||||
: BaseOptions(trx),
|
: BaseOptions(trx),
|
||||||
direction("outbound"),
|
direction("outbound"),
|
||||||
useWeight(false),
|
|
||||||
weightAttribute(""),
|
weightAttribute(""),
|
||||||
defaultWeight(1),
|
defaultWeight(1),
|
||||||
bidirectional(true),
|
bidirectional(true),
|
||||||
|
@ -85,6 +83,10 @@ VPackSlice ShortestPathOptions::getStart() const {
|
||||||
|
|
||||||
VPackSlice ShortestPathOptions::getEnd() const { return endBuilder.slice(); }
|
VPackSlice ShortestPathOptions::getEnd() const { return endBuilder.slice(); }
|
||||||
|
|
||||||
|
bool ShortestPathOptions::useWeight() const {
|
||||||
|
return !weightAttribute.empty();
|
||||||
|
}
|
||||||
|
|
||||||
void ShortestPathOptions::toVelocyPack(VPackBuilder& builder) const {
|
void ShortestPathOptions::toVelocyPack(VPackBuilder& builder) const {
|
||||||
VPackObjectBuilder guard(&builder);
|
VPackObjectBuilder guard(&builder);
|
||||||
builder.add("weightAttribute", VPackValue(weightAttribute));
|
builder.add("weightAttribute", VPackValue(weightAttribute));
|
||||||
|
|
|
@ -42,7 +42,6 @@ struct ShortestPathOptions : public BaseOptions {
|
||||||
public:
|
public:
|
||||||
std::string start;
|
std::string start;
|
||||||
std::string direction;
|
std::string direction;
|
||||||
bool useWeight;
|
|
||||||
std::string weightAttribute;
|
std::string weightAttribute;
|
||||||
double defaultWeight;
|
double defaultWeight;
|
||||||
bool bidirectional;
|
bool bidirectional;
|
||||||
|
@ -68,6 +67,9 @@ struct ShortestPathOptions : public BaseOptions {
|
||||||
arangodb::velocypack::Slice getStart() const;
|
arangodb::velocypack::Slice getStart() const;
|
||||||
arangodb::velocypack::Slice getEnd() 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.
|
/// @brief Build a velocypack for cloning in the plan.
|
||||||
void toVelocyPack(arangodb::velocypack::Builder&) const override;
|
void toVelocyPack(arangodb::velocypack::Builder&) const override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue