Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flattened wrapper on property graph to run apps defined on simple graph #888

Merged
merged 38 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run:
shell: bash --noprofile --norc -eo pipefail {0}
container:
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:v0.3.1
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:test_wrapper
acezen marked this conversation as resolved.
Show resolved Hide resolved
options:
--shm-size 4096m
strategy:
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
run:
shell: bash --noprofile --norc -eo pipefail {0}
container:
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:v0.3.1
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:test_wrapper
steps:
- name: Install Dependencies
run: |
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
run:
shell: bash --noprofile --norc -eo pipefail {0}
container:
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:v0.3.1
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:test_wrapper
steps:
- uses: actions/checkout@v2.3.2
with:
Expand Down Expand Up @@ -543,7 +543,7 @@ jobs:
run:
shell: bash --noprofile --norc -eo pipefail {0}
container:
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:v0.3.1
image: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-vineyard:test_wrapper
steps:

#- name: "Debug: Package dependancies for tmate"
Expand Down
11 changes: 8 additions & 3 deletions analytical_engine/apps/boundary/edge_boundary.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ limitations under the License.
#include "grape/grape.h"

#include "apps/boundary/edge_boundary_context.h"
#include "apps/boundary/utils.h"
#include "core/app/app_base.h"

namespace gs {
Expand All @@ -47,17 +48,21 @@ class EdgeBoundary : public AppBase<FRAG_T, EdgeBoundaryContext<FRAG_T>>,
message_manager_t& messages) {
// parse input node array from json
folly::dynamic node_array_1 = folly::parseJson(ctx.nbunch1);
std::vector<oid_t> oid_array_1;
ExtractOidArrayFromDynamic(node_array_1, oid_array_1);
std::set<vid_t> node_gid_set, node_gid_set_2;
vid_t gid;
vertex_t u;
for (const auto& oid : node_array_1) {
for (const auto& oid : oid_array_1) {
if (frag.Oid2Gid(oid, gid)) {
node_gid_set.insert(gid);
}
}
if (!ctx.nbunch2.empty()) {
auto node_array_2 = folly::parseJson(ctx.nbunch2);
for (const auto& oid : node_array_2) {
std::vector<oid_t> oid_array_2;
ExtractOidArrayFromDynamic(node_array_2, oid_array_2);
for (const auto& oid : oid_array_2) {
acezen marked this conversation as resolved.
Show resolved Hide resolved
if (frag.Oid2Gid(oid, gid)) {
node_gid_set_2.insert(gid);
}
Expand All @@ -67,7 +72,7 @@ class EdgeBoundary : public AppBase<FRAG_T, EdgeBoundaryContext<FRAG_T>>,
// get the boundary
for (auto& gid : node_gid_set) {
if (frag.InnerVertexGid2Vertex(gid, u)) {
for (auto e : frag.GetOutgoingAdjList(u)) {
for (auto& e : frag.GetOutgoingAdjList(u)) {
vid_t vgid = frag.Vertex2Gid(e.get_neighbor());
if (node_gid_set_2.empty()) {
if (node_gid_set.find(vgid) == node_gid_set.end()) {
Expand Down
9 changes: 7 additions & 2 deletions analytical_engine/apps/boundary/node_boundary.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ limitations under the License.
#include "grape/grape.h"

#include "apps/boundary/node_boundary_context.h"
#include "apps/boundary/utils.h"
#include "core/app/app_base.h"

namespace gs {
Expand All @@ -47,17 +48,21 @@ class NodeBoundary : public AppBase<FRAG_T, NodeBoundaryContext<FRAG_T>>,
message_manager_t& messages) {
// parse input node array from json
folly::dynamic node_array_1 = folly::parseJson(ctx.nbunch1);
std::vector<oid_t> oid_array_1;
acezen marked this conversation as resolved.
Show resolved Hide resolved
ExtractOidArrayFromDynamic(node_array_1, oid_array_1);
std::set<vid_t> node_gid_set, node_gid_set_2;
vid_t gid;
vertex_t v;
for (const auto& oid : node_array_1) {
for (const auto& oid : oid_array_1) {
if (frag.Oid2Gid(oid, gid)) {
node_gid_set.insert(gid);
}
}
if (!ctx.nbunch2.empty()) {
auto node_array_2 = folly::parseJson(ctx.nbunch2);
for (const auto& oid : node_array_2) {
std::vector<oid_t> oid_array_2;
ExtractOidArrayFromDynamic(node_array_2, oid_array_2);
for (const auto& oid : oid_array_2) {
if (frag.Oid2Gid(oid, gid)) {
node_gid_set_2.insert(gid);
}
Expand Down
52 changes: 52 additions & 0 deletions analytical_engine/apps/boundary/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/** Copyright 2020 Alibaba Group Holding Limited.
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.
Author: Ma JingYuan
acezen marked this conversation as resolved.
Show resolved Hide resolved
*/

#ifndef ANALYTICAL_ENGINE_APPS_BOUNDARY_UTILS_H_
#define ANALYTICAL_ENGINE_APPS_BOUNDARY_UTILS_H_

#include <string>
#include <vector>

#include "folly/dynamic.h"

namespace gs {
template <typename T>
void ExtractOidArrayFromDynamic(folly::dynamic node_array,
acezen marked this conversation as resolved.
Show resolved Hide resolved
std::vector<T>& oid_array) {}

template <>
void ExtractOidArrayFromDynamic<int64_t>(folly::dynamic node_array,
std::vector<int64_t>& oid_array) {
for (const auto& val : node_array) {
oid_array.push_back(val.asInt());
}
}

template <>
void ExtractOidArrayFromDynamic<std::string>(
folly::dynamic node_array, std::vector<std::string>& oid_array) {
for (const auto& val : node_array) {
oid_array.push_back(val.asString());
}
}

template <>
void ExtractOidArrayFromDynamic<folly::dynamic>(
folly::dynamic node_array, std::vector<folly::dynamic>& oid_array) {
for (const auto& val : node_array) {
oid_array.push_back(val);
}
}
} // namespace gs

#endif // ANALYTICAL_ENGINE_APPS_BOUNDARY_UTILS_H_
1 change: 1 addition & 0 deletions analytical_engine/apps/projected/sssp_projected.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class SSSPProjected : public AppBase<FRAG_T, SSSPProjectedContext<FRAG_T>> {
auto es = frag.GetOutgoingAdjList(u);
for (auto& e : es) {
v = e.neighbor();

distv = ctx.partial_result[v];
double edata = 1.0;
static_if<!std::is_same<edata_t, grape::EmptyType>{}>(
Expand Down
1 change: 1 addition & 0 deletions analytical_engine/core/context/tensor_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "core/context/i_context.h"
#include "core/context/tensor_dataframe_builder.h"
#include "core/error.h"
#include "core/fragment/arrow_label_projected_fragment.h"
#include "core/fragment/arrow_projected_fragment.h"
#include "core/fragment/dynamic_projected_fragment.h"
#include "core/object/i_fragment_wrapper.h"
Expand Down
1 change: 1 addition & 0 deletions analytical_engine/core/context/vertex_data_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "core/context/i_context.h"
#include "core/context/tensor_dataframe_builder.h"
#include "core/error.h"
#include "core/fragment/arrow_label_projected_fragment.h"
#include "core/fragment/arrow_projected_fragment.h"
#include "core/fragment/dynamic_projected_fragment.h"
#include "core/utils/transform_utils.h"
Expand Down
Loading