Skip to content

Commit 4d91fb1

Browse files
authoredMar 7, 2023··
Merge pull request #139 from tigergraph/3.9
Updating master to 3.9
2 parents 8383057 + 9d4a391 commit 4d91fb1

File tree

9 files changed

+84
-40
lines changed

9 files changed

+84
-40
lines changed
 

‎.github/auto_request_review.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ reviewers:
1111
group1:
1212
- yimingpantg
1313
- TannerW
14-
- wyatt-joyner-tg
15-
- parkererickson
16-
- lennessyy
17-
- a-m-thomas
14+
- wyattjoynertg
15+
- parkererickson-tg
16+
- alexthomasTG
1817
secondary:
1918
- yimingpantg
20-
- wyatt-joyner-tg
19+
- wyattjoynertg
20+
- TannerW
2121
tertiary:
2222
- xinyuchtg
23-
- victor-gsl
23+
- victorleeTG
24+
- TannerW
2425

2526
files:
2627
# All review request will be sent to the following groups/people.

‎.github/workflows/review.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
auto-request-review:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: necojackarc/auto-request-review@v0.4.0
15+
- uses: necojackarc/auto-request-review@v0.10.0
1616
with:
1717
token: ${{ secrets.GITHUB_TOKEN }}
18+
config: .github/auto_request_review.yml

‎GDBMS_ALGO/centrality/pagerank.gsql

+12-3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.pagerank (STRING v_type, STRING e_ty
5656

5757
TYPEDEF TUPLE<VERTEX Vertex_ID, FLOAT score> Vertex_Score;
5858
HeapAccum<Vertex_Score>(top_k, score DESC) @@top_scores_heap;
59+
SetAccum<VERTEX> @@top_vertices; # vertices with top score
5960
MaxAccum<FLOAT> @@max_diff = 9999; # max score change in an iteration
6061
SumAccum<FLOAT> @sum_recvd_score = 0; # sum of scores each vertex receives FROM neighbors
6162
SumAccum<FLOAT> @sum_score = 1; # initial score for every vertex is 1.
@@ -99,11 +100,19 @@ V = SELECT s
99100
IF print_results THEN
100101
PRINT @@top_scores_heap;
101102
IF display_edges THEN
102-
PRINT Start[Start.@sum_score];
103-
Start = SELECT s
104-
FROM Start:s -(e_type:e)- v_type:t
103+
104+
FOREACH vert IN @@top_scores_heap DO
105+
@@top_vertices += vert.Vertex_ID;
106+
END;
107+
108+
Top = {@@top_vertices};
109+
Top = SELECT s
110+
FROM Top:s -(e_type:e)- v_type:t
111+
WHERE @@top_vertices.contains(t)
105112
ACCUM @@edge_set += e;
113+
106114
PRINT @@edge_set;
115+
PRINT Top;
107116
END;
108117
END;
109118
}

‎GDBMS_ALGO/centrality/pagerank_wt.gsql

+14-5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.pagerank_wt (STRING v_type, STRING e
6060

6161
TYPEDEF TUPLE<VERTEX Vertex_ID, FLOAT score> Vertex_Score;
6262
HeapAccum<Vertex_Score>(top_k, score DESC) @@top_scores_heap;
63+
SetAccum<VERTEX> @@top_vertices; # vertices with top score
6364
MaxAccum<FLOAT> @@max_diff = 9999; # max score change in an iteration
6465
SumAccum<FLOAT> @sum_recvd_score = 0; # sum of scores each vertex receives FROM neighbors
6566
SumAccum<FLOAT> @sum_score = 1; # initial score for every vertex is 1.
@@ -107,11 +108,19 @@ V = SELECT s
107108
IF print_results THEN
108109
PRINT @@top_scores_heap;
109110
IF display_edges THEN
110-
PRINT Start[Start.@sum_score];
111-
Start = SELECT s
112-
FROM Start:s -(e_type:e)- v_type:t
113-
ACCUM @@edge_set += e;
114-
PRINT @@edge_set;
111+
112+
FOREACH vert IN @@top_scores_heap DO
113+
@@top_vertices += vert.Vertex_ID;
114+
END;
115+
116+
Top = {@@top_vertices};
117+
Top = SELECT s
118+
FROM Top:s -(e_type:e)- v_type:t
119+
WHERE @@top_vertices.contains(t)
120+
ACCUM @@edge_set += e;
121+
122+
PRINT @@edge_set;
123+
PRINT Top;
115124
END;
116125
END;
117126
}

‎algorithms/Centrality/pagerank/global/unweighted/tg_pagerank.gsql

+12-3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ CREATE QUERY tg_pagerank (STRING v_type, STRING e_type,
5656

5757
TYPEDEF TUPLE<VERTEX Vertex_ID, FLOAT score> Vertex_Score;
5858
HeapAccum<Vertex_Score>(top_k, score DESC) @@top_scores_heap;
59+
SetAccum<VERTEX> @@top_vertices; # vertices with top score
5960
MaxAccum<FLOAT> @@max_diff = 9999; # max score change in an iteration
6061
SumAccum<FLOAT> @sum_recvd_score = 0; # sum of scores each vertex receives FROM neighbors
6162
SumAccum<FLOAT> @sum_score = 1; # initial score for every vertex is 1.
@@ -99,11 +100,19 @@ V = SELECT s
99100
IF print_results THEN
100101
PRINT @@top_scores_heap;
101102
IF display_edges THEN
102-
PRINT Start[Start.@sum_score];
103-
Start = SELECT s
104-
FROM Start:s -(e_type:e)- v_type:t
103+
104+
FOREACH vert IN @@top_scores_heap DO
105+
@@top_vertices += vert.Vertex_ID;
106+
END;
107+
108+
Top = {@@top_vertices};
109+
Top = SELECT s
110+
FROM Top:s -(e_type:e)- v_type:t
111+
WHERE @@top_vertices.contains(t)
105112
ACCUM @@edge_set += e;
113+
106114
PRINT @@edge_set;
115+
PRINT Top;
107116
END;
108117
END;
109118
}

‎algorithms/Centrality/pagerank/global/weighted/tg_pagerank_wt.gsql

+14-5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ CREATE QUERY tg_pagerank_wt (STRING v_type, STRING e_type, STRING weight_attribu
6060

6161
TYPEDEF TUPLE<VERTEX Vertex_ID, FLOAT score> Vertex_Score;
6262
HeapAccum<Vertex_Score>(top_k, score DESC) @@top_scores_heap;
63+
SetAccum<VERTEX> @@top_vertices; # vertices with top score
6364
MaxAccum<FLOAT> @@max_diff = 9999; # max score change in an iteration
6465
SumAccum<FLOAT> @sum_recvd_score = 0; # sum of scores each vertex receives FROM neighbors
6566
SumAccum<FLOAT> @sum_score = 1; # initial score for every vertex is 1.
@@ -107,11 +108,19 @@ V = SELECT s
107108
IF print_results THEN
108109
PRINT @@top_scores_heap;
109110
IF display_edges THEN
110-
PRINT Start[Start.@sum_score];
111-
Start = SELECT s
112-
FROM Start:s -(e_type:e)- v_type:t
113-
ACCUM @@edge_set += e;
114-
PRINT @@edge_set;
111+
112+
FOREACH vert IN @@top_scores_heap DO
113+
@@top_vertices += vert.Vertex_ID;
114+
END;
115+
116+
Top = {@@top_vertices};
117+
Top = SELECT s
118+
FROM Top:s -(e_type:e)- v_type:t
119+
WHERE @@top_vertices.contains(t)
120+
ACCUM @@edge_set += e;
121+
122+
PRINT @@edge_set;
123+
PRINT Top;
115124
END;
116125
END;
117126
}

‎algorithms/GraphML/Embeddings/FastRP/tg_algo_fastRP.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
sha_id: ed6ea869749977cc0f3df71225d7325fb81c9767
1313
description: "Generates node embeddings of low dimensionality through random projections from the graph's adjacency matrix (a high-dimensional matrix) to a low-dimensional matrix, significantly reducing the computing power required for data processing. "
1414
schema_constraints: This algorithm can optionally write the embedding results back to the graph if the target vertex type(s) have a list attribute of type DOUBLE.
15-
version: lib3.0
16-
include: false
15+
version: lib3.8
16+
include: true
1717
dependencies:
1818
ExprFunctions:
1919
sha_id: ed6ea869749977cc0f3df71225d7325fb81c9767

‎algorithms/GraphML/Embeddings/FastRP/tg_fastRP.gsql

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CREATE QUERY tg_fastRP(
2-
SET<STRING> v_type,
3-
SET<STRING> e_type,
4-
SET<STRING> output_v_type,
2+
SET<STRING> v_type_set,
3+
SET<STRING> e_type_set,
4+
SET<STRING> output_v_type_set,
55
STRING iteration_weights,
66
FLOAT beta,
77
INT embedding_dimension,
@@ -57,11 +57,11 @@ CREATE QUERY tg_fastRP(
5757

5858

5959
Parameters:
60-
v_type:
60+
v_type_set:
6161
Set of all vertex types to traverse in the graph.
62-
e_type:
62+
e_type_set:
6363
Set of all edge types to traverse in the graph.
64-
output_v_type:
64+
output_v_type_set:
6565
Set of vertex types to produce output embeddings for.
6666
iteration_weights:
6767
A comma-separated string of numbers to weight each iteration of the embedding process.
@@ -165,7 +165,7 @@ CREATE QUERY tg_fastRP(
165165
weight_idx = weight_idx + 1;
166166
END;
167167

168-
verts = {v_type};
168+
verts = {v_type_set};
169169
// component_attr should indicate which batch each vertex belongs to, if none defined, just use all vertex types provided
170170
IF component_attribute != "" THEN
171171
verts =
@@ -182,22 +182,22 @@ CREATE QUERY tg_fastRP(
182182
// L stores the normalized diagonal elements of an inverse degree matrix
183183
// this is defined in the original algorithm and is useful for initialization
184184
verts =
185-
SELECT s FROM verts:s -(e_type:e)- v_type:t
185+
SELECT s FROM verts:s -(e_type_set:e)- v_type_set:t
186186
WHERE t.@include == TRUE
187187
ACCUM @@m += 1
188-
POST-ACCUM s.@L = pow(s.outdegree(e_type) / @@m, beta);
188+
POST-ACCUM s.@L = pow(s.outdegree(e_type_set) / @@m, beta);
189189

190190
// randomly initialize the topological embedding regions
191191
verts =
192-
SELECT s FROM verts:s -(e_type:e)- v_type:t
192+
SELECT s FROM verts:s -(e_type_set:e)- v_type_set:t
193193
WHERE t.@include == TRUE
194194
ACCUM
195195
// PRNG code
196196
INT inc = (getvid(s)+_inc),
197197
INT r = ((inc+_mult*random_seed) % _mod),
198198
FLOAT mr = 0,
199199
STRING temp_e_type = e.type,
200-
// if the edge type wasn't explicitly specified, but was provided in e_type,
200+
// if the edge type wasn't explicitly specified, but was provided in e_type_set,
201201
// then its information will reside in the 'default' region of the embedding vector
202202
IF @@embedding_dim_map.containsKey(e.type) == FALSE THEN
203203
temp_e_type = "default"
@@ -221,14 +221,14 @@ CREATE QUERY tg_fastRP(
221221

222222
// propagate embeddings to neighbors and normalize
223223
verts =
224-
SELECT s FROM verts:s -(e_type)- v_type:t
224+
SELECT s FROM verts:s -(e_type_set)- v_type_set:t
225225
WHERE t.@include == TRUE
226226
ACCUM
227227
t.@embedding_arr += s.@embedding_arr
228228
POST-ACCUM
229229
// first calculate square sum to help normalize
230230
FLOAT square_sum = 0,
231-
FLOAT out = max([1.0, t.outdegree(e_type)]),
231+
FLOAT out = max([1.0, t.outdegree(e_type_set)]),
232232
FOREACH (i,total) IN t.@embedding_arr DO
233233
square_sum = square_sum + pow(total / out, 2)
234234
END,
@@ -256,7 +256,7 @@ CREATE QUERY tg_fastRP(
256256
// the arrays are converted to lists for compatibility with GSQL's LIST type
257257
verts =
258258
SELECT s FROM verts:s
259-
WHERE output_v_type.size() == 0 OR output_v_type.contains(s.type)
259+
WHERE output_v_type_set.size() == 0 OR output_v_type_set.contains(s.type)
260260
POST-ACCUM
261261
FOREACH i IN RANGE[0, embedding_dimension-1] DO
262262
s.@final_embedding_list += s.@final_embedding_arr.get(i) / @@weights.size() // Average by # of iterations

‎manifest.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@
108108
"path": "algorithms/Community/connected_components/strongly_connected_components/standard/tg_scc.gsql",
109109
"schema_type": "VERTEX",
110110
"value_type": "INT"
111-
}
111+
},
112+
"weakly_connected_components": {
113+
"name": "tg_wcc",
114+
"path": "algorithms/Community/connected_components/weakly_connected_components/standard/tg_wcc.gsql",
115+
"schema_type": "VERTEX",
116+
"value_type": "INT"
117+
}
112118
},
113119
"k_core": {
114120
"name": "tg_kcore",

0 commit comments

Comments
 (0)
Please sign in to comment.