mirror of https://gitee.com/bigwinds/arangodb
Started with a sketch on message formats including the sender key
This commit is contained in:
parent
1cc34c846f
commit
03caa2e097
|
@ -0,0 +1,61 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2016 ArangoDB GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Simon Grätzer
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef ARANGODB_PREGEL_ADDITIONAL_MFORMATS_H
|
||||||
|
#define ARANGODB_PREGEL_ADDITIONAL_MFORMATS_H 1
|
||||||
|
|
||||||
|
|
||||||
|
#include "Pregel/MessageFormat.h"
|
||||||
|
#include "Pregel/Graph.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace arangodb {
|
||||||
|
namespace pregel {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct SenderValue {
|
||||||
|
PregelID pregelId;
|
||||||
|
T value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct NumberSenderFormat : public MessageFormat<SenderValue<T>> {
|
||||||
|
static_assert(std::is_arithmetic<T>::value, "Message type must be numeric");
|
||||||
|
NumberSenderFormat() {}
|
||||||
|
void unwrapValue(VPackSlice s, SenderValue<T>& senderVal) const override {
|
||||||
|
VPackArrayIterator array(s);
|
||||||
|
senderVal.pregelId.shard = (*array).getUInt();
|
||||||
|
senderVal.pregelId.key = (*(++array)).copyString();
|
||||||
|
senderVal.value = (*(++array)).getNumber<T>();
|
||||||
|
}
|
||||||
|
void addValue(VPackBuilder& arrayBuilder, SenderValue<T> const& senderVal) const override {
|
||||||
|
arrayBuilder.openArray();
|
||||||
|
arrayBuilder.add(VPackValue(senderVal.pregelId.shard));
|
||||||
|
arrayBuilder.add(VPackValue(senderVal.pregelId.key));
|
||||||
|
arrayBuilder.add(VPackValue(senderVal.value));
|
||||||
|
arrayBuilder.close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -33,6 +33,7 @@ namespace algos {
|
||||||
/// vertex id along the edges to all vertices of a connected component. The
|
/// vertex id along the edges to all vertices of a connected component. The
|
||||||
/// number of supersteps necessary is equal to the length of the maximum
|
/// number of supersteps necessary is equal to the length of the maximum
|
||||||
/// diameter of all components + 1
|
/// diameter of all components + 1
|
||||||
|
/// doesn't necessarily leads to a correct result on unidirected graphs
|
||||||
struct ConnectedComponents : public SimpleAlgorithm<int64_t, int64_t, int64_t> {
|
struct ConnectedComponents : public SimpleAlgorithm<int64_t, int64_t, int64_t> {
|
||||||
public:
|
public:
|
||||||
ConnectedComponents(VPackSlice userParams) : SimpleAlgorithm("ConnectedComponents", userParams) {}
|
ConnectedComponents(VPackSlice userParams) : SimpleAlgorithm("ConnectedComponents", userParams) {}
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
/// @author Simon Grätzer
|
/// @author Simon Grätzer
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "IncomingCache.h"
|
#include "Pregel/IncomingCache.h"
|
||||||
#include "Utils.h"
|
#include "Pregel/Utils.h"
|
||||||
|
//#include "Pregel/AdditionalFormats.h"
|
||||||
|
|
||||||
#include "Basics/MutexLocker.h"
|
#include "Basics/MutexLocker.h"
|
||||||
#include "Basics/StaticStrings.h"
|
#include "Basics/StaticStrings.h"
|
||||||
|
@ -252,12 +253,12 @@ void CombiningInCache<M>::forEach(
|
||||||
}
|
}
|
||||||
|
|
||||||
// template types to create
|
// template types to create
|
||||||
template class arangodb::pregel::InCache<int32_t>;
|
//template class arangodb::pregel::InCache<SenderValue<int64_t>>;
|
||||||
template class arangodb::pregel::InCache<int64_t>;
|
template class arangodb::pregel::InCache<int64_t>;
|
||||||
template class arangodb::pregel::InCache<float>;
|
template class arangodb::pregel::InCache<float>;
|
||||||
template class arangodb::pregel::ArrayInCache<int32_t>;
|
//template class arangodb::pregel::ArrayInCache<SenderValue<int64_t>>;
|
||||||
template class arangodb::pregel::ArrayInCache<int64_t>;
|
template class arangodb::pregel::ArrayInCache<int64_t>;
|
||||||
template class arangodb::pregel::ArrayInCache<float>;
|
template class arangodb::pregel::ArrayInCache<float>;
|
||||||
template class arangodb::pregel::CombiningInCache<int32_t>;
|
//template class arangodb::pregel::CombiningInCache<SenderValue<int64_t>>;
|
||||||
template class arangodb::pregel::CombiningInCache<int64_t>;
|
template class arangodb::pregel::CombiningInCache<int64_t>;
|
||||||
template class arangodb::pregel::CombiningInCache<float>;
|
template class arangodb::pregel::CombiningInCache<float>;
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
/// @author Simon Grätzer
|
/// @author Simon Grätzer
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef ARANGODB_PREGEL_MFORMAT_H
|
||||||
|
#define ARANGODB_PREGEL_MFORMAT_H 1
|
||||||
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include "Basics/Common.h"
|
#include "Basics/Common.h"
|
||||||
|
|
||||||
|
@ -27,8 +31,6 @@
|
||||||
#include <velocypack/Iterator.h>
|
#include <velocypack/Iterator.h>
|
||||||
#include <velocypack/velocypack-aliases.h>
|
#include <velocypack/velocypack-aliases.h>
|
||||||
|
|
||||||
#ifndef ARANGODB_PREGEL_MFORMAT_H
|
|
||||||
#define ARANGODB_PREGEL_MFORMAT_H 1
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
namespace pregel {
|
namespace pregel {
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ struct NumberMessageFormat : public MessageFormat<M> {
|
||||||
arrayBuilder.add(VPackValue(val));
|
arrayBuilder.add(VPackValue(val));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
/// @author Simon Grätzer
|
/// @author Simon Grätzer
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "OutgoingCache.h"
|
#include "Pregel/OutgoingCache.h"
|
||||||
#include "IncomingCache.h"
|
#include "Pregel/IncomingCache.h"
|
||||||
#include "Utils.h"
|
#include "Pregel/Utils.h"
|
||||||
#include "WorkerConfig.h"
|
#include "Pregel/WorkerConfig.h"
|
||||||
|
//#include "Pregel/AdditionalFormats.h"
|
||||||
|
|
||||||
#include "Basics/MutexLocker.h"
|
#include "Basics/MutexLocker.h"
|
||||||
#include "Basics/StaticStrings.h"
|
#include "Basics/StaticStrings.h"
|
||||||
|
@ -257,9 +258,12 @@ void CombiningOutCache<M>::flushMessages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// template types to create
|
// template types to create
|
||||||
|
//template class arangodb::pregel::OutCache<SenderValue<int64_t>>;
|
||||||
template class arangodb::pregel::OutCache<int64_t>;
|
template class arangodb::pregel::OutCache<int64_t>;
|
||||||
template class arangodb::pregel::OutCache<float>;
|
template class arangodb::pregel::OutCache<float>;
|
||||||
|
//template class arangodb::pregel::ArrayOutCache<SenderValue<int64_t>>;
|
||||||
template class arangodb::pregel::ArrayOutCache<int64_t>;
|
template class arangodb::pregel::ArrayOutCache<int64_t>;
|
||||||
template class arangodb::pregel::ArrayOutCache<float>;
|
template class arangodb::pregel::ArrayOutCache<float>;
|
||||||
|
//template class arangodb::pregel::CombiningOutCache<SenderValue<int64_t>>;
|
||||||
template class arangodb::pregel::CombiningOutCache<int64_t>;
|
template class arangodb::pregel::CombiningOutCache<int64_t>;
|
||||||
template class arangodb::pregel::CombiningOutCache<float>;
|
template class arangodb::pregel::CombiningOutCache<float>;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "Pregel/Utils.h"
|
#include "Pregel/Utils.h"
|
||||||
#include "Pregel/VertexComputation.h"
|
#include "Pregel/VertexComputation.h"
|
||||||
#include "Pregel/WorkerConfig.h"
|
#include "Pregel/WorkerConfig.h"
|
||||||
|
//#include "Pregel/AdditionalFormats.h"
|
||||||
|
|
||||||
#include "Basics/MutexLocker.h"
|
#include "Basics/MutexLocker.h"
|
||||||
#include "Basics/ReadLocker.h"
|
#include "Basics/ReadLocker.h"
|
||||||
|
@ -659,3 +660,5 @@ Worker<V, E, M>::_callConductorWithResponse(std::string const& path,
|
||||||
// template types to create
|
// template types to create
|
||||||
template class arangodb::pregel::Worker<int64_t, int64_t, int64_t>;
|
template class arangodb::pregel::Worker<int64_t, int64_t, int64_t>;
|
||||||
template class arangodb::pregel::Worker<float, float, float>;
|
template class arangodb::pregel::Worker<float, float, float>;
|
||||||
|
// complex types
|
||||||
|
//template class arangodb::pregel::Worker<int64_t, int64_t, SenderValue<int64_t>>;
|
||||||
|
|
Loading…
Reference in New Issue