diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bae2eb12..5bf95ac01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -241,7 +241,6 @@ FILE(COPY ${include_dir}/storage/label/label_collection.hpp DESTINATION ${build_ FILE(COPY ${include_dir}/storage/label/label_store.hpp DESTINATION ${build_include_dir}/storage/label) FILE(COPY ${include_dir}/storage/indexes/index_record.hpp DESTINATION ${build_include_dir}/storage/indexes) -FILE(COPY ${include_dir}/storage/indexes/index_record_collection.hpp DESTINATION ${build_include_dir}/storage/indexes) FILE(COPY ${include_dir}/storage/indexes/index_base.hpp DESTINATION ${build_include_dir}/storage/indexes) FILE(COPY ${include_dir}/storage/indexes/impl/nonunique_unordered_index.hpp DESTINATION ${build_include_dir}/storage/indexes/impl) diff --git a/README.md b/README.md index 8b7325980..41c1b7594 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,25 @@ ctest -R concurrent ctest -R concurrent --parallel 4 ``` -# custom test build example +## Proof of concept + +### Dressipi + +Run command: +``` +cd build/poc +MEMGRAPH_CONFIG=/path/to/config/memgraph.yaml ./poc_astar -v "dressipi/graph_nodes_export.csv" -e "dressipi/graph_edges_export.csv" +``` + +### Powerlinx + +Run command: +``` +cd build/poc +MEMGRAPH_CONFIG=/path/to/config/memgraph.yaml ./profile -d ";" -v "node_account.csv" -v "node_company.csv" -v "node_opportunity.csv" -v "node_personnel.csv" -e "rel_created.csv" -e "rel_has_match.csv" -e "rel_interested_in.csv" -e "rel_is_employee.csv" -e "rel_partnered_with.csv" -e "rel_reached_to.csv" -e "rel_searched_and_clicked.csv" -e "rel_viewed.csv" -e "rel_works_in.csv" +``` + +# Custom test build example clang++ -std=c++1y -o concurrent_skiplist ../tests/concurrent/skiplist.cpp -pg -I../src/ -I../libs/fmt -Lfmt-prefix/src/fmt-build/fmt -lfmt -lpthread # TODO diff --git a/build/compiled/.gitignore b/build/compiled/.gitignore deleted file mode 100644 index 6a16f0329..000000000 --- a/build/compiled/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/* -!.gitignore -!/cpu diff --git a/build/compiled/cpu/.gitignore b/build/compiled/cpu/.gitignore deleted file mode 100644 index 50ce2e0a4..000000000 --- a/build/compiled/cpu/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/* -!.gitignore -!/hardcode diff --git a/build/compiled/cpu/hardcode/135757557963690525.cpp b/build/compiled/cpu/hardcode/135757557963690525.cpp deleted file mode 100644 index a87fd0b2d..000000000 --- a/build/compiled/cpu/hardcode/135757557963690525.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include -#include - -#include "query_engine/i_code_cpu.hpp" -#include "storage/model/properties/all.hpp" -#include "utils/memory/stack_allocator.hpp" - -using std::cout; -using std::endl; - -// Dressipi astar query of 4 clicks. - -// BARRIER! -namespace barrier -{ - -// using STREAM = std::ostream; -using STREAM = RecordStream<::io::Socket>; - -constexpr size_t max_depth = 3; -constexpr size_t limit = 10; - -class Node -{ -public: - Node *parent = {nullptr}; - VertexPropertyType tkey; - double cost; - int depth = {0}; - VertexAccessor vacc; - - Node(VertexAccessor vacc, double cost, - VertexPropertyType const &tkey) - : cost(cost), vacc(vacc), tkey(tkey) - { - } - Node(VertexAccessor vacc, double cost, Node *parent, - VertexPropertyType const &tkey) - : cost(cost), vacc(vacc), parent(parent), depth(parent->depth + 1), - tkey(tkey) - { - } - - double sum_vertex_score() - { - auto now = this; - double sum = 0; - do { - sum += (now->vacc.at(tkey).get())->value(); - now = now->parent; - } while (now != nullptr); - return sum; - } -}; - -bool vertex_filter_contained(DbAccessor &t, VertexAccessor &v, Node *before) -{ - if (v.fill()) { - bool found; - do { - found = false; - before = before->parent; - if (before == nullptr) { - return true; - } - } while (v.in_contains(before->vacc)); - } - return false; -} - -void astar(DbAccessor &t, code_args_t &args, STREAM &stream) -{ - StackAllocator stack; - - VertexPropertyType tkey = t.vertex_property_key("score"); - - auto cmp = [](Node *left, Node *right) { return left->cost > right->cost; }; - std::priority_queue, decltype(cmp)> queue(cmp); - std::vector all_nodes; - - auto start_vr = t.vertex_find(Id(args[0].as().value())); - if (!start_vr.is_present()) { - stream.write_failure({{}}); - return; - } - - start_vr.get().fill(); - Node *start = stack.make(start_vr.take(), 0, tkey); - queue.push(start); - all_nodes.push_back(start); - - int count = 0; - do { - auto now = queue.top(); - queue.pop(); - - if (max_depth <= now->depth) { - // best.push_back(now); - count++; - if (count >= limit) { - break; - } - continue; - } - - iter::for_all(now->vacc.out(), [&](auto edge) { - VertexAccessor va = edge.to(); - if (vertex_filter_contained(t, va, now)) { - auto cost = 1 - va.at(tkey).get()->value(); - Node *n = stack.make(va, now->cost + cost, now, tkey); - queue.push(n); - all_nodes.push_back(n); - } - }); - } while (!queue.empty()); - - stream.write_field("n"); - stream.write_record(); - stream.write_list_header(0); - stream.chunk(); - stream.write_meta("r"); - - // for (auto n : all_nodes) { - // delete n; - // } - - stack.free(); -} - -class CodeCPU : public ICodeCPU -{ -public: - bool run(Db &db, code_args_t &args, STREAM &stream) override - { - DbAccessor t(db); - - astar(t, args, stream); - - return t.commit(); - } - - ~CodeCPU() {} -}; -} - -extern "C" ICodeCPU *produce() -{ - // BARRIER! - return new barrier::CodeCPU(); -} - -extern "C" void destruct(ICodeCPU *p) { delete p; }