Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,76 @@ public void testAlgorithmJaccardSimilarity() throws Exception {
.checkSinkResult();
}

@Test
public void testAlgorithmJaccardSimilarityNoCommonNeighbors() throws Exception {
QueryTester
.build()
.withGraphDefine("/query/modern_graph.sql")
.withQueryPath("/query/gql_algorithm_jaccard_similarity_no_common.sql")
.execute()
.checkSinkResult();
}

@Test
public void testAlgorithmJaccardSimilarityIdenticalVertices() throws Exception {
QueryTester
.build()
.withGraphDefine("/query/modern_graph.sql")
.withQueryPath("/query/gql_algorithm_jaccard_similarity_identical.sql")
.execute()
.checkSinkResult();
}

@Test
public void testAlgorithmJaccardSimilarityHighSimilarity() throws Exception {
QueryTester
.build()
.withGraphDefine("/query/modern_graph.sql")
.withQueryPath("/query/gql_algorithm_jaccard_similarity_high.sql")
.execute()
.checkSinkResult();
}

@Test
public void testAlgorithmJaccardSimilarityCompleteOverlap() throws Exception {
QueryTester
.build()
.withGraphDefine("/query/jaccard_similarity_test_graph.sql")
.withQueryPath("/query/gql_algorithm_jaccard_similarity_complete_overlap.sql")
.execute()
.checkSinkResult();
}

@Test
public void testAlgorithmJaccardSimilarityDisjointSets() throws Exception {
QueryTester
.build()
.withGraphDefine("/query/jaccard_similarity_test_graph.sql")
.withQueryPath("/query/gql_algorithm_jaccard_similarity_disjoint.sql")
.execute()
.checkSinkResult();
}

@Test
public void testAlgorithmJaccardSimilaritySelfLoop() throws Exception {
QueryTester
.build()
.withGraphDefine("/query/jaccard_similarity_test_graph.sql")
.withQueryPath("/query/gql_algorithm_jaccard_similarity_selfloop.sql")
.execute()
.checkSinkResult();
}

@Test
public void testAlgorithmJaccardSimilarityIsolatedVertex() throws Exception {
QueryTester
.build()
.withGraphDefine("/query/jaccard_similarity_test_graph.sql")
.withQueryPath("/query/gql_algorithm_jaccard_similarity_isolated.sql")
.execute()
.checkSinkResult();
}

@Test
public void testEdgeIterator() throws Exception {
QueryTester
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1,2,1.0
1,3,1.0
1,4,1.0
2,3,1.0
2,4,1.0
3,4,1.0
5,6,1.0
5,7,1.0
6,7,1.0
9,9,1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
1,node1
2,node2
3,node3
4,node4
5,node5
6,node6
7,node7
8,isolated
9,selfloop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3,4,0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1,5,0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4,1,0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8,1,0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2,6,0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE result_tb (
vertex_a int,
vertex_b int,
jaccard_coefficient double
) WITH (
type='file',
geaflow.dsl.file.path='${target}'
);

USE GRAPH jaccard_test;

INSERT INTO result_tb
CALL jaccard_similarity(3, 4) YIELD (vertex_a, vertex_b, jaccard_coefficient)
RETURN cast(vertex_a as int), cast(vertex_b as int), jaccard_coefficient
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE result_tb (
vertex_a int,
vertex_b int,
jaccard_coefficient double
) WITH (
type='file',
geaflow.dsl.file.path='${target}'
);

USE GRAPH jaccard_test;

INSERT INTO result_tb
CALL jaccard_similarity(1, 5) YIELD (vertex_a, vertex_b, jaccard_coefficient)
RETURN cast(vertex_a as int), cast(vertex_b as int), jaccard_coefficient
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE result_tb (
vertex_a int,
vertex_b int,
jaccard_coefficient double
) WITH (
type='file',
geaflow.dsl.file.path='${target}'
);

USE GRAPH modern;

INSERT INTO result_tb
CALL jaccard_similarity(4, 1) YIELD (vertex_a, vertex_b, jaccard_coefficient)
RETURN cast(vertex_a as int), cast(vertex_b as int), jaccard_coefficient
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE result_tb (
vertex_a int,
vertex_b int,
jaccard_coefficient double
) WITH (
type='file',
geaflow.dsl.file.path='${target}'
);

USE GRAPH modern;

INSERT INTO result_tb
CALL jaccard_similarity(1, 1) YIELD (vertex_a, vertex_b, jaccard_coefficient)
RETURN cast(vertex_a as int), cast(vertex_b as int), jaccard_coefficient
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE result_tb (
vertex_a int,
vertex_b int,
jaccard_coefficient double
) WITH (
type='file',
geaflow.dsl.file.path='${target}'
);

USE GRAPH jaccard_test;

INSERT INTO result_tb
CALL jaccard_similarity(8, 1) YIELD (vertex_a, vertex_b, jaccard_coefficient)
RETURN cast(vertex_a as int), cast(vertex_b as int), jaccard_coefficient
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE result_tb (
vertex_a int,
vertex_b int,
jaccard_coefficient double
) WITH (
type='file',
geaflow.dsl.file.path='${target}'
);

USE GRAPH modern;

INSERT INTO result_tb
CALL jaccard_similarity(2, 6) YIELD (vertex_a, vertex_b, jaccard_coefficient)
RETURN cast(vertex_a as int), cast(vertex_b as int), jaccard_coefficient
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE result_tb (
vertex_a int,
vertex_b int,
jaccard_coefficient double
) WITH (
type='file',
geaflow.dsl.file.path='${target}'
);

USE GRAPH jaccard_test;

INSERT INTO result_tb
CALL jaccard_similarity(9, 9) YIELD (vertex_a, vertex_b, jaccard_coefficient)
RETURN cast(vertex_a as int), cast(vertex_b as int), jaccard_coefficient
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

CREATE TABLE v_node (
id bigint,
name varchar
) WITH (
type='file',
geaflow.dsl.window.size = -1,
geaflow.dsl.file.path = 'resource:///data/jaccard_test_vertex.txt'
);

CREATE TABLE e_link (
srcId bigint,
targetId bigint,
weight double
) WITH (
type='file',
geaflow.dsl.window.size = -1,
geaflow.dsl.file.path = 'resource:///data/jaccard_test_edge.txt'
);

CREATE GRAPH jaccard_test (
Vertex node using v_node WITH ID(id),
Edge link using e_link WITH ID(srcId, targetId)
) WITH (
storeType='memory',
shardCount = 2
);
Loading