Skip to content

Commit e4ad722

Browse files
Merge pull request #171 from tigergraph/tg_4.1.0_dev
Tg 4.1.0 dev
2 parents 7b066d8 + 54cecf8 commit e4ad722

File tree

224 files changed

+1878
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+1878
-568
lines changed

.DS_Store

-6 KB
Binary file not shown.

.github/auto_request_review.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,28 @@
44
reviewers:
55
# The default reviewers if not assigned specifically
66
defaults:
7+
- primary
78
- secondary
89
- tertiary
910
# Reviewer groups each of which has a list of GitHub usernames
1011
groups:
11-
group1:
12+
primary:
1213
- RobRossmiller-TG
1314
- wyattjoynertg
1415
- parkererickson-tg
15-
- GabrielTigerGraph
16-
secondary:
17-
- RobRossmiller-TG
18-
- wyattjoynertg
19-
tertiary:
20-
- xinyuchtg
2116
- victorleeTG
17+
# secondary:
18+
# - RobRossmiller-TG
19+
# - wyattjoynertg
20+
# tertiary:
21+
# - victorleeTG
2222

2323
files:
2424
# All review request will be sent to the following groups/people.
2525
'**':
26-
- secondary
27-
- tertiary
26+
- primary
27+
# - secondary
28+
# - tertiary
2829

2930
options:
3031
# ignore draft PRs

CODE_OF_CONDUCT.md

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official email address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement by reaching out to one of the contributors
63+
of this repository. All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series of
85+
actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or permanent
92+
ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within the
112+
community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.1, available at
118+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
119+
120+
Community Impact Guidelines were inspired by
121+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
122+
123+
For answers to common questions about this code of conduct, see the FAQ at
124+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
125+
[https://www.contributor-covenant.org/translations][translations].
126+
127+
[homepage]: https://www.contributor-covenant.org
128+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
129+
[Mozilla CoC]: https://github.com/mozilla/diversity
130+
[FAQ]: https://www.contributor-covenant.org/faq
131+
[translations]: https://www.contributor-covenant.org/translations
132+

CONTRIBUTING.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contribution Guidelines
2+
3+
## Issues
4+
If you discover an issue with an algorithm, or test, open an issue to point out areas for improvement.
5+
If you are comfortable with it, implement the fix and open a PR.
6+
7+
8+
## Adding tests
9+
See the [testing contributors guide](tests/CONTRIBUTING.md)
10+
11+
## Coding Standards
12+
13+
### Languages
14+
15+
*GSQL*
16+
- Follow the [GSQL Style Guide](https://docs.tigergraph.com/gsql-ref/current/appendix/gsql-style-guide)
17+
18+
*Python*
19+
- Use the [ruff formatter](https://docs.astral.sh/ruff/formatter/#the-ruff-formatter) to format your code
20+
- tests: pytest and networkx wherever applicable
21+
22+
*C/CPP*
23+
24+
25+
## Pull Requests
26+
- Make sure git knows your name and email address:
27+
```
28+
$ git config user.name "J. Random User"
29+
$ git config user.email "[email protected]"
30+
```
31+
- The name and email address must be valid as we cannot accept anonymous contributions.
32+
- Write good commit messages.
33+
- Concise commit messages that describe your changes help us better understand your contributions.
34+
35+
## General Guidelines
36+
37+
Ensure your pull request (PR) adheres to the following guidelines:
38+
39+
- Try to make the name concise and descriptive.
40+
- Give a good description of the change being made. Since this is very subjective, see the [Updating Your Pull Request (PR)](#updating-your-pull-request-pr) section below for further details.
41+
- Every pull request should be associated with one or more issues. If no issue exists yet, please create your own.
42+
- Make sure that all applicable issues are mentioned somewhere in the PR description. This can be done by typing # to bring up a list of issues.
43+
44+
### Updating Your Pull Request (PR)
45+
46+
A lot of times, making a PR adhere to the standards above can be difficult. If the maintainers notice anything that we'd like changed, we'll ask you to edit your PR before we merge it.
47+
This applies to both the content documented in the PR and the changed contained within the branch being merged. There's no need to open a new PR. Just edit the existing one.
48+
49+
---
50+
51+
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
52+

GDBMS_ALGO/centrality/degree_cent.gsql

+50-48
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,72 @@
11
CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.degree_cent(SET<STRING> v_type_set, SET<STRING> e_type_set, SET<STRING> reverse_e_type_set, BOOL in_degree = TRUE, BOOL out_degree = TRUE,
2-
INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "") SYNTAX V1 {
3-
2+
INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "", BOOL normalize = TRUE) SYNTAX V1 {
43
/*
5-
First Author: <First Author Name>
6-
First Commit Date: <First Commit Date>
7-
8-
Recent Author: <Recent Commit Author Name>
9-
Recent Commit Date: <Recent Commit Date>
4+
First Author: <First Author Name>
5+
First Commit Date: <First Commit Date>
106

7+
Recent Author: Rob Rossmiller
8+
Recent Commit Date: 05/2024
119

12-
Repository:
13-
https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Centrality
1410

15-
Maturity:
16-
Production
11+
Repository:
12+
https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Centrality
1713

18-
Description:
19-
Compute degree Centrality for each VERTEX.
20-
for undirected graph, you only need to set e_type_set and indegree
14+
Maturity:
15+
Production
2116

22-
Publications:
23-
NA
17+
Description:
18+
Compute degree Centrality for each VERTEX.
19+
for undirected graph, you only need to set e_type_set and indegree
2420

25-
TigerGraph Documentation:
26-
https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/degree-centrality
21+
Publications:
22+
NA
2723

28-
Parameters:
29-
v_type_set:
30-
vertex types to traverse
31-
e_type_set:
32-
edge types to traverse
33-
reverse_e_type_set:
34-
for indegree use
35-
in_degree:
36-
If True, count incoming relationships
37-
out_degree:
38-
If True, count outcoming relationships
39-
top_k:
40-
report only this many top scores
41-
print_results:
42-
If True, print the result
43-
result_attribute:
44-
attribute to write result to
45-
file_path:
46-
file to write CSV output to
24+
TigerGraph Documentation:
25+
https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/degree-centrality
4726

27+
Parameters:
28+
v_type_set:
29+
vertex types to traverse
30+
e_type_set:
31+
edge types to traverse
32+
reverse_e_type_set:
33+
for indegree use
34+
in_degree:
35+
If True, count incoming relationships
36+
out_degree:
37+
If True, count outcoming relationships
38+
top_k:
39+
report only this many top scores
40+
print_results:
41+
If True, print the result
42+
result_attribute:
43+
attribute to write result to
44+
file_path:
45+
file to write CSV output to
46+
normailize:
47+
If True, return the normalized centrality. Default: True
4848
*/
4949

5050
TYPEDEF TUPLE<VERTEX Vertex_ID, FLOAT score> Vertex_Score;
5151
HeapAccum<Vertex_Score>(top_k, score DESC) @@top_scores_heap;
52-
SumAccum<INT> @sum_degree_score;
52+
SumAccum<DOUBLE> @sum_degree_score;
5353
FILE f (file_path);
5454

5555
all = {v_type_set};
5656
sll = SELECT s
5757
FROM all:s
58-
ACCUM IF in_degree THEN
59-
FOREACH edge_type in reverse_e_type_set DO
60-
s.@sum_degree_score+=s.outdegree(edge_type)
61-
END
62-
END,
63-
IF out_degree THEN
64-
FOREACH edge_type in e_type_set DO
65-
s.@sum_degree_score+=s.outdegree(edge_type)
66-
END
67-
END;
58+
ACCUM
59+
IF in_degree THEN
60+
s.@sum_degree_score += s.outdegree(reverse_e_type_set)
61+
END,
62+
IF out_degree THEN
63+
s.@sum_degree_score += s.outdegree(e_type_set)
64+
END
65+
POST-ACCUM
66+
IF normalize THEN
67+
s.@sum_degree_score = s.@sum_degree_score / (all.size() - 1)
68+
END;
69+
6870
#Output
6971
IF file_path != "" THEN
7072
f.println("Vertex_ID", "Degree");

0 commit comments

Comments
 (0)