diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5a06dfc6..00000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.github/auto_request_review.yml b/.github/auto_request_review.yml index 9fc7ed24..197024ed 100644 --- a/.github/auto_request_review.yml +++ b/.github/auto_request_review.yml @@ -4,27 +4,28 @@ reviewers: # The default reviewers if not assigned specifically defaults: + - primary - secondary - tertiary # Reviewer groups each of which has a list of GitHub usernames groups: - group1: + primary: - RobRossmiller-TG - wyattjoynertg - parkererickson-tg - - GabrielTigerGraph - secondary: - - RobRossmiller-TG - - wyattjoynertg - tertiary: - - xinyuchtg - victorleeTG + # secondary: + # - RobRossmiller-TG + # - wyattjoynertg + # tertiary: + # - victorleeTG files: # All review request will be sent to the following groups/people. '**': - - secondary - - tertiary + - primary + # - secondary + # - tertiary options: # ignore draft PRs diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..fa0f963c --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement by reaching out to one of the contributors +of this repository. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..ebbb9d0e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contribution Guidelines + +## Issues +If you discover an issue with an algorithm, or test, open an issue to point out areas for improvement. +If you are comfortable with it, implement the fix and open a PR. + + +## Adding tests +See the [testing contributors guide](tests/CONTRIBUTING.md) + +## Coding Standards + +### Languages + +*GSQL* +- Follow the [GSQL Style Guide](https://docs.tigergraph.com/gsql-ref/current/appendix/gsql-style-guide) + +*Python* +- Use the [ruff formatter](https://docs.astral.sh/ruff/formatter/#the-ruff-formatter) to format your code +- tests: pytest and networkx wherever applicable + +*C/CPP* + + +## Pull Requests +- Make sure git knows your name and email address: + ``` + $ git config user.name "J. Random User" + $ git config user.email "j.random.user@example.com" + ``` +- The name and email address must be valid as we cannot accept anonymous contributions. +- Write good commit messages. + - Concise commit messages that describe your changes help us better understand your contributions. + +## General Guidelines + +Ensure your pull request (PR) adheres to the following guidelines: + +- Try to make the name concise and descriptive. +- 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. +- Every pull request should be associated with one or more issues. If no issue exists yet, please create your own. +- 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. + +### Updating Your Pull Request (PR) + +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. +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. + +--- + +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. + diff --git a/GDBMS_ALGO/centrality/degree_cent.gsql b/GDBMS_ALGO/centrality/degree_cent.gsql index a12b84a3..c048d177 100644 --- a/GDBMS_ALGO/centrality/degree_cent.gsql +++ b/GDBMS_ALGO/centrality/degree_cent.gsql @@ -1,70 +1,72 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.degree_cent(SET v_type_set, SET e_type_set, SET reverse_e_type_set, BOOL in_degree = TRUE, BOOL out_degree = TRUE, - INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "") SYNTAX V1 { - + INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "", BOOL normalize = TRUE) SYNTAX V1 { /* - First Author: - First Commit Date: - - Recent Author: - Recent Commit Date: + First Author: + First Commit Date: + Recent Author: Rob Rossmiller + Recent Commit Date: 05/2024 - Repository: - https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Centrality - Maturity: - Production + Repository: + https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Centrality - Description: - Compute degree Centrality for each VERTEX. - for undirected graph, you only need to set e_type_set and indegree + Maturity: + Production - Publications: - NA + Description: + Compute degree Centrality for each VERTEX. + for undirected graph, you only need to set e_type_set and indegree - TigerGraph Documentation: - https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/degree-centrality + Publications: + NA - Parameters: - v_type_set: - vertex types to traverse - e_type_set: - edge types to traverse - reverse_e_type_set: - for indegree use - in_degree: - If True, count incoming relationships - out_degree: - If True, count outcoming relationships - top_k: - report only this many top scores - print_results: - If True, print the result - result_attribute: - attribute to write result to - file_path: - file to write CSV output to + TigerGraph Documentation: + https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/degree-centrality + Parameters: + v_type_set: + vertex types to traverse + e_type_set: + edge types to traverse + reverse_e_type_set: + for indegree use + in_degree: + If True, count incoming relationships + out_degree: + If True, count outcoming relationships + top_k: + report only this many top scores + print_results: + If True, print the result + result_attribute: + attribute to write result to + file_path: + file to write CSV output to + normailize: + If True, return the normalized centrality. Default: True */ TYPEDEF TUPLE Vertex_Score; HeapAccum(top_k, score DESC) @@top_scores_heap; - SumAccum @sum_degree_score; + SumAccum @sum_degree_score; FILE f (file_path); all = {v_type_set}; sll = SELECT s FROM all:s - ACCUM IF in_degree THEN - FOREACH edge_type in reverse_e_type_set DO - s.@sum_degree_score+=s.outdegree(edge_type) - END - END, - IF out_degree THEN - FOREACH edge_type in e_type_set DO - s.@sum_degree_score+=s.outdegree(edge_type) - END - END; + ACCUM + IF in_degree THEN + s.@sum_degree_score += s.outdegree(reverse_e_type_set) + END, + IF out_degree THEN + s.@sum_degree_score += s.outdegree(e_type_set) + END + POST-ACCUM + IF normalize THEN + s.@sum_degree_score = s.@sum_degree_score / (all.size() - 1) + END; + #Output IF file_path != "" THEN f.println("Vertex_ID", "Degree"); diff --git a/GDBMS_ALGO/centrality/weighted_degree_cent.gsql b/GDBMS_ALGO/centrality/weighted_degree_cent.gsql index 3c8dcac4..79fcaef9 100644 --- a/GDBMS_ALGO/centrality/weighted_degree_cent.gsql +++ b/GDBMS_ALGO/centrality/weighted_degree_cent.gsql @@ -1,5 +1,4 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.weighted_degree_cent(STRING v_type, STRING e_type, STRING reverse_e_type, string weight_attribute, BOOL in_degree = TRUE, BOOL out_degree = TRUE, INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "") SYNTAX V1 { - /* First Author: First Commit Date: @@ -22,18 +21,20 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.weighted_degree_cent(STRING v_type, for undirected graph, you only need to set e_type and in_degree Publications: - + NA TigerGraph Documentation: - + https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/weighted-degree-centrality Parameters: v_type: - vertex types to traverse + Vertex types to traverse e_type: - edge types to traverse + Edge types to traverse reverse_e_type: - for indegree use + For indegree use + weight_attribute: + The edge weight attribute name in_degree: If True, count incoming relationships out_degree: @@ -43,27 +44,28 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.weighted_degree_cent(STRING v_type, print_results: If True, print the results result_attribute: - attribute to write result to + Attribute to write result to file_path: - file to write CSV output to - */ + File to write CSV output to + */ TYPEDEF TUPLE Vertex_Score; HeapAccum(top_k, score DESC) @@top_scores_heap; - SumAccum @sum_degree_score; + SumAccum @sum_degree_score; FILE f (file_path); all = {v_type}; IF in_degree THEN sll = SELECT s - FROM all:s-(reverse_e_type:e)-:t - ACCUM s.@sum_degree_score+=e.getAttr(weight_attribute,"INT"); + FROM all:s -(reverse_e_type:e)- :t + ACCUM s.@sum_degree_score += e.getAttr(weight_attribute, "FLOAT"); END; IF out_degree THEN sll = SELECT s - FROM all:s-(e_type:e)-:t - ACCUM s.@sum_degree_score+=e.getAttr(weight_attribute,"INT"); + FROM all:s -(e_type:e)- :t + ACCUM s.@sum_degree_score += e.getAttr(weight_attribute, "FLOAT"); END; + #Output IF file_path != "" THEN f.println("Vertex_ID", "Degree"); @@ -72,17 +74,17 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.centrality.weighted_degree_cent(STRING v_type, Start = SELECT s FROM all:s POST-ACCUM - IF result_attribute != "" THEN - s.setAttr(result_attribute, s.@sum_degree_score) - END, - - IF print_results THEN - @@top_scores_heap += Vertex_Score(s, s.@sum_degree_score) - END, - - IF file_path != "" THEN - f.println(s, s.@sum_degree_score) - END; + IF result_attribute != "" THEN + s.setAttr(result_attribute, s.@sum_degree_score) + END, + + IF print_results THEN + @@top_scores_heap += Vertex_Score(s, s.@sum_degree_score) + END, + + IF file_path != "" THEN + f.println(s, s.@sum_degree_score) + END; IF print_results THEN PRINT @@top_scores_heap AS top_scores; diff --git a/GDBMS_ALGO/community/label_prop.gsql b/GDBMS_ALGO/community/label_prop.gsql index aa4c727d..779adee0 100644 --- a/GDBMS_ALGO/community/label_prop.gsql +++ b/GDBMS_ALGO/community/label_prop.gsql @@ -1,14 +1,21 @@ -CREATE TEMPLATE QUERY GDBMS_ALGO.community.label_prop (SET v_type_set, SET e_type_set, INT maximum_iteration, INT print_limit, - BOOL print_results = TRUE, STRING file_path = "", STRING result_attribute = "") SYNTAX V1 { - +CREATE TEMPLATE QUERY GDBMS_ALGO.community.label_prop( + SET v_type_set, + SET e_type_set, + UINT maximum_iteration = 10, + UINT sample_edge_num = 1000, + UINT batch_num = 12, + INT print_limit, + BOOL print_results = TRUE, + STRING result_attribute = "", + STRING file_path="" +) SYNTAX V1 { /* - First Author: - First Commit Date: - - Recent Author: - Recent Commit Date: + First Author: xuanlei.lin@tigergraph.com + First Commit Date: 2024-07-15 + Recent Author: xuanlei.lin@tigergraph.com + Recent Commit Date: 2024-07-16 Repository: https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Community @@ -17,89 +24,160 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.community.label_prop (SET v_type_set, S Production Description: - Partition the vertices into communities, according to the Label Propagation method. - Indicate community membership by assigning each vertex a community ID. - - Publications: - NA + This query partitions vertices into communities using the Label Propagation method. + It assigns a community ID to each vertex based on its neighbors' community IDs. TigerGraph Documentation: https://docs.tigergraph.com/graph-ml/current/community-algorithms/label-propagation Parameters: v_type_set: - Names of vertex types to use + The set of vertex types to traverse. e_type_set: - Names of edge types to use + The set of edge types to traverse. maximum_iteration: - Number of maximum iteration of the algorithm + The maximum number of iterations for the algorithm. + sample_edge_num: + The number of edges to sample for super nodes. + batch_num: + The number of batches. Using batches reduces memory consumption. print_limit: - If >=0, max number of vertices to output to JSON. + If >= 0, the maximum number of vertices to output to JSON. print_results: - If True, output JSON to standard output + If True, output JSON to standard output. WARNING: Avoid printing results for large datasets. result_attribute: - If not empty, store community id values (INT) to this attribute + If not empty, store community ID values (INT) in this attribute. file_path: - If not empty, write output to this file. + File to write CSV output to. */ -OrAccum @@or_changed = true; -MapAccum @map; # -MapAccum @@comm_sizes_map; # -SumAccum @sum_label, @sum_num; -FILE f (file_path); -Start = {v_type_set}; + TYPEDEF TUPLE MoveScore; + MinAccum @community_id; // Community ID of the node + SumAccum @vid; // Vertex's internal ID + SumAccum @batch_id; // Batch ID for the node + SumAccum @degree; // Outdegree of the node + SumAccum @@vertex_num; // Total number of vertices + MapAccum> @community_k_in_map; // Number of neighbors belonging to each community + MaxAccum @best_move; // Best move for the node with the highest score + MaxAccum @@min_double; // Used to reset the @best_move + OrAccum @to_change_community; // Flag to check if the node needs to change community + MapAccum @@comm_sizes_map; // Map: community ID -> size of the community + FILE f(file_path); // File to write results to + + // Initialization + All_Nodes = {v_type_set}; + Tmp = SELECT s + FROM All_Nodes:s -(e_type_set:e)- :t + POST-ACCUM + s.@community_id = s, + s.@vid = getvid(s), + s.@batch_id = s.@vid % batch_num, + s.@degree = s.outdegree(e_type_set); + @@vertex_num = All_Nodes.size(); + @@vertex_num = @@vertex_num / batch_num; + + // Label propagation + INT hop = 0; + Candidates = All_Nodes; + WHILE Candidates.size() > 0 AND hop < maximum_iteration DO + hop = hop + 1; + // Find the best move + IF hop == 1 THEN // First iteration + ChangedNodes = SELECT s + FROM Candidates:s -(e_type_set:e)- :t + WHERE s.@degree < t.@degree + ACCUM s.@best_move += MoveScore(t.@degree, t.@community_id) + POST-ACCUM + IF s.@best_move.community != s.@community_id THEN + s.@to_change_community = TRUE + END + HAVING s.@to_change_community == TRUE; + ELSE // Remaining iterations + IF Candidates.size() < @@vertex_num OR batch_num == 1 THEN // No batch processing + ChangedNodes = SELECT s + FROM Candidates:s -(e_type_set:e)- :t + SAMPLE sample_edge_num EDGE WHEN s.outdegree(e_type_set) > sample_edge_num + ACCUM s.@community_k_in_map += (t.@community_id -> 1) + POST-ACCUM + s.@best_move = MoveScore(@@min_double, s), // Reset best move + FOREACH (community_id, k_in) IN s.@community_k_in_map DO + s.@best_move += MoveScore(k_in, community_id) + END, + IF s.@best_move.community != s.@community_id THEN + s.@to_change_community = TRUE + END, + s.@community_k_in_map.clear() + HAVING s.@to_change_community == TRUE; + ELSE // Use batch processing + ChangedNodes = {}; + FOREACH batch_id IN RANGE[0, batch_num-1] DO + Nodes = SELECT s + FROM Candidates:s + WHERE s.@batch_id == batch_id; + Nodes = SELECT s + FROM Nodes:s -(e_type_set:e)- :t + SAMPLE sample_edge_num EDGE WHEN s.outdegree(e_type_set) > sample_edge_num + ACCUM s.@community_k_in_map += (t.@community_id -> 1) + POST-ACCUM + s.@best_move = MoveScore(@@min_double, s), // Reset best move + FOREACH (community_id, k_in) IN s.@community_k_in_map DO + s.@best_move += MoveScore(k_in, community_id) + END, + IF s.@best_move.community != s.@community_id THEN + s.@to_change_community = TRUE + END, + s.@community_k_in_map.clear() + HAVING s.@to_change_community == TRUE; + ChangedNodes = ChangedNodes UNION Nodes; + END; + END; + END; + + // Handle nodes that swap communities + SwapNodes = SELECT s + FROM ChangedNodes:s -(e_type_set:e)- :t + WHERE s.@best_move.community == t.@community_id + AND t.@to_change_community == TRUE + AND t.@best_move.community == s.@community_id + AND (s.@best_move.score < t.@best_move.score + OR (abs(s.@best_move.score - t.@best_move.score) < 0.00000000001 + AND s.@vid > t.@vid)) + POST-ACCUM + s.@to_change_community = FALSE; + ChangedNodes = ChangedNodes MINUS SwapNodes; -# Assign unique labels to each vertex -Start = SELECT s - FROM Start:s - ACCUM s.@sum_label = getvid(s); + // Update community IDs + ChangedNodes = SELECT s + FROM ChangedNodes:s + POST-ACCUM + s.@community_id = s.@best_move.community, + s.@to_change_community = FALSE; -# Propagate labels to neighbors until labels converge or the max iterations is reached -WHILE @@or_changed == true LIMIT maximum_iteration DO - @@or_changed = false; - Start = SELECT s - FROM Start:s -(e_type_set:e)- :t - ACCUM t.@map += (s.@sum_label -> 1) # count the occurrences of neighbor's labels - POST-ACCUM - INT max_v = 0, - INT label = 0, - # Iterate over the map to get the neighbor label that occurs most often - FOREACH (k,v) IN t.@map DO - CASE WHEN v > max_v THEN - max_v = v, - label = k - END - END, - # When the neighbor search finds a label AND it is a new label - # AND the label's count has increased, update the label. - CASE WHEN label != 0 AND t.@sum_label != label AND max_v > t.@sum_num THEN - @@or_changed += true, - t.@sum_label = label, - t.@sum_num = max_v - END, - t.@map.clear(); -END; + // Find candidates for the next iteration + Candidates = SELECT t + FROM ChangedNodes:s -(e_type_set:e)- :t + WHERE t.@community_id != s.@community_id; + END; -Start = {v_type_set}; -Start = SELECT s - FROM Start:s - POST-ACCUM - IF result_attribute != "" THEN - s.setAttr(result_attribute, s.@sum_label) - END, - - IF file_path != "" THEN - f.println(s, s.@sum_label) - END, - - IF print_results THEN - @@comm_sizes_map += (s.@sum_label -> 1) - END - LIMIT print_limit; + // Output results + Nodes = SELECT s + FROM All_Nodes:s + POST-ACCUM + IF result_attribute != "" THEN + s.setAttr(result_attribute, getvid(s.@community_id)) + END, + IF print_results THEN + @@comm_sizes_map += (s.@community_id -> 1) + END, + IF file_path != "" THEN + VERTEX node = s.@community_id, + f.println(s.type, s, node.type, node) + END + LIMIT print_limit; -IF print_results THEN + // Print results if print_results is True + IF print_results THEN PRINT @@comm_sizes_map; - PRINT Start[Start.@sum_label]; -END; + PRINT Nodes[Nodes.@community_id]; + END; } diff --git a/GDBMS_ALGO/community/louvain.gsql b/GDBMS_ALGO/community/louvain.gsql index f7c13e32..bc9d9fdd 100644 --- a/GDBMS_ALGO/community/louvain.gsql +++ b/GDBMS_ALGO/community/louvain.gsql @@ -1,13 +1,20 @@ -CREATE TEMPLATE QUERY GDBMS_ALGO.community.louvain(SET v_type_set, SET e_type_set, STRING weight_attribute = "weight", INT maximum_iteration = 10, - STRING result_attribute = "cid", STRING file_path = "", BOOL print_stats = FALSE) SYNTAX V1 { +CREATE TEMPLATE QUERY GDBMS_ALGO.community.louvain( + SET v_type_set, + SET e_type_set, + STRING weight_attribute = "weight", + UINT total_passes_count = 3, + UINT maximum_iteration = 10, + UINT total_batch_count = 12, + STRING result_attribute = "", + STRING file_path = "" +) SYNTAX V2 { /* - First Author: - First Commit Date: - - Recent Author: - Recent Commit Date: + First Author: xuanlei.lin@tigergraph.com + First Commit Date: 2024-07-16 + Recent Author: xuanlei.lin@tigergraph.com + Recent Commit Date: 2024-07-16 Repository: https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Community @@ -16,231 +23,361 @@ CREATE TEMPLATE QUERY GDBMS_ALGO.community.louvain(SET v_type_set, SET move; - SumAccum @sum_ac; #sum of the degrees of all the vertices in community C of the vertex - ListAccum @cc_list; #the community center - SumAccum @sum_weight; # total weight incident to this vertex - SumAccum @sum_cc_weight; # total weight incident to the cc vertex - MapAccum> @A_map; #A[c]: sum of the edge weights for the edges in community c - MaxAccum @max_best_move; # highest dQ, highest -Outdegree, highest cc - ListAccum @cm_list; #community member list - SumAccum @@sum_m; # total edge weight - SumAccum @sum_outdegree; # helper variable for outdegree calculation - SumAccum @@sum_cc_change; - MapAccum> @@community_map; - MapAccum> @@community_size_count; + TYPEDEF TUPLE MyTuple; + SumAccum @@m; // The sum of the weights of all the links in the network. + MinAccum @community_id; // The community ID of the node. + SumAccum @k; // The sum of the weights of the links incident to the node. + SumAccum @k_in; // The sum of the weights of the links inside the previous community of the node. + SumAccum @k_self_loop; // The weight of the self-loop link. + MapAccum> @community_k_in_map; // Community of the neighbors of the nodes -> Sum of the weights of the links inside the community. + MapAccum> @@community_sum_total_map; // Community ID C -> Sum of the weights of the links incident to nodes in C. + SumAccum @community_sum_total; // Sum of the weights of the links incident to nodes in the community of the node. + MapAccum> @@community_sum_in_map; // Community ID -> Sum of the weights of the links inside the community. + MapAccum>> @@source_target_k_in_map; // Source community ID -> (Target community ID -> Sum of the weights of the links from the source community to the target community). + SumAccum @delta_Q_remove; // Delta Q to remove the node from the previous community. + MaxAccum @best_move; // Best move of the node with the highest delta Q to move the isolated node into the new community. + MaxAccum @@min_double; // Used to reset the @best_move. + OrAccum @to_change_community; + SumAccum @batch_id; + SumAccum @vid; FILE f(file_path); - // initialize - Start = {v_type_set}; - Start = SELECT s - FROM Start:s -(e_type_set:e)- :t - ACCUM - @@sum_m += e.getAttr(weight_attribute, "FLOAT")*0.5, - s.@sum_weight += e.getAttr(weight_attribute, "FLOAT")*1.0, - s.@sum_cc_weight += e.getAttr(weight_attribute, "FLOAT")*1.0, - s.@sum_outdegree += 1 - // mark @cc only for vertices with more than 1 neighbors - // and only the marked vertices will participate in the actual louvain algorithm - // the unmorked vertices will be resolved by the vertex following heuristic - POST-ACCUM - IF s.@sum_outdegree > 1 THEN - s.@cc_list += s - END; - IF print_stats THEN - PRINT Start.size() AS AllVertexCount; + // Virtual edges + CREATE DIRECTED VIRTUAL EDGE belongs_to (FROM *, TO *, layer_set SET); + CREATE UNDIRECTED VIRTUAL EDGE links_to (FROM *, TO *, layer_weight_map MAP); + + // -------------------- 1. First pass -------------------- + // Initialization + All_Nodes = {v_type_set}; + All_Nodes = SELECT s + FROM All_Nodes:s -(e_type_set:e)- :t + ACCUM @@m += e.getAttr(weight_attribute, "DOUBLE") / 2, + s.@k += e.getAttr(weight_attribute, "DOUBLE"), + IF s == t THEN // Self-loop link + s.@k_self_loop += e.getAttr(weight_attribute, "DOUBLE") + END + POST-ACCUM + s.@community_id = s, + s.@vid = getvid(s), + s.@batch_id = s.@vid % total_batch_count; + IF @@m < 0.00000000001 THEN + RETURN; END; - // special @cc update in the first iteration - Start = SELECT t - FROM Start:s -(e_type_set:e)- :t - WHERE s.@sum_outdegree > 1 AND t.@sum_outdegree > 1 - ACCUM - t.@max_best_move += move(e.getAttr(weight_attribute, "FLOAT")*1.0 + @@sum_m*t.@sum_weight * - (t.@sum_weight - s.@sum_weight), -s.@sum_cc_weight, s.@cc_list.get(0)) - POST-ACCUM - IF t.@max_best_move.deltaQ > 0 THEN - IF -t.@max_best_move.weight < t.@sum_cc_weight THEN - t.@cc_list.clear(), - t.@cc_list += t.@max_best_move.cc, - t.@sum_cc_weight = -t.@max_best_move.weight, - @@sum_cc_change += 1 - ELSE - IF -t.@max_best_move.weight == t.@sum_cc_weight AND getvid(t) < getvid(t.@max_best_move.cc) THEN - t.@cc_list.clear(), - t.@cc_list += t.@max_best_move.cc, - t.@sum_cc_weight = -t.@max_best_move.weight, - @@sum_cc_change += 1 - END - END - END; - IF print_stats THEN - PRINT @@sum_cc_change AS InitChangeCount; + // Local moving + INT hop = 0; + Pass_Nodes = All_Nodes; + Candidates (ANY) = Pass_Nodes; + WHILE Candidates.size() > 0 AND hop < maximum_iteration DO + hop = hop + 1; + IF hop == 1 THEN // First iteration + ChangedNodes = SELECT s + FROM Candidates:s -(e_type_set:e)- :t + WHERE s.@community_id != t.@community_id + ACCUM s.@best_move += MyTuple(1 - s.@k * t.@k / (2 * @@m), t.@community_id) + POST-ACCUM + IF s.@best_move.delta_Q_add > 0 THEN // The gain (delta Q) is positive + s.@to_change_community = TRUE + END + HAVING s.@to_change_community == TRUE; + ELSE // Remaining iterations + // Calculate sum_total + Tmp = SELECT s + FROM Pass_Nodes:s + POST-ACCUM + @@community_sum_total_map += (s.@community_id -> s.@k); + Tmp = SELECT s + FROM Pass_Nodes:s + POST-ACCUM + s.@community_sum_total = @@community_sum_total_map.get(s.@community_id); + @@community_sum_total_map.clear(); + // Find the best move + ChangedNodes = {}; + FOREACH batch_id IN RANGE[0, total_batch_count-1] DO + // Calculate the delta Q to remove the node from the previous community + Nodes = SELECT s + FROM Candidates:s -(e_type_set:e)- :t + WHERE s.@batch_id == batch_id + ACCUM IF s.@community_id == t.@community_id THEN + s.@k_in += e.getAttr(weight_attribute, "DOUBLE") + ELSE + s.@community_k_in_map += (t.@community_id -> e.getAttr(weight_attribute, "DOUBLE")) + END + POST-ACCUM + s.@delta_Q_remove = 2 * s.@k_self_loop - 2 * s.@k_in + s.@k * (s.@community_sum_total - s.@k) / @@m, + s.@k_in = 0, + s.@best_move = MyTuple(@@min_double, s); // Reset the delta_Q_add + // Find the best move + Nodes = SELECT s + FROM Nodes:s -(e_type_set:e)- :t + WHERE s.@community_id != t.@community_id + ACCUM DOUBLE delta_Q_add = 2 * s.@community_k_in_map.get(t.@community_id) - s.@k * t.@community_sum_total / @@m, + s.@best_move += MyTuple(delta_Q_add, t.@community_id) + POST-ACCUM + IF s.@delta_Q_remove + s.@best_move.delta_Q_add > 0 THEN // The gain (delta Q) is positive + s.@to_change_community = TRUE + END, + s.@community_k_in_map.clear() + HAVING s.@to_change_community == TRUE; + ChangedNodes = ChangedNodes UNION Nodes; + END; + END; + // If two nodes swap, only change the community of one of them + SwapNodes = SELECT s + FROM ChangedNodes:s -(e_type_set:e)- :t + WHERE s.@best_move.community == t.@community_id + AND t.@to_change_community == TRUE + AND t.@best_move.community == s.@community_id + // Only change the one with larger delta Q or the one with smaller @vid if delta Q are the same + AND (s.@delta_Q_remove + s.@best_move.delta_Q_add < t.@delta_Q_remove + t.@best_move.delta_Q_add + OR (abs((s.@delta_Q_remove + s.@best_move.delta_Q_add) - (t.@delta_Q_remove + t.@best_move.delta_Q_add)) < 0.00000000001 + AND s.@vid > t.@vid)) + POST-ACCUM + s.@to_change_community = FALSE; + ChangedNodes = ChangedNodes MINUS SwapNodes; + // Place each node of ChangedNodes in the community in which the gain is maximum + ChangedNodes = SELECT s + FROM ChangedNodes:s + POST-ACCUM + s.@community_id = s.@best_move.community, + s.@to_change_community = FALSE; + // Get all neighbours of the changed node that do not belong to the node’s new community + Candidates = SELECT t + FROM ChangedNodes:s -(e_type_set:e)- :t + WHERE t.@community_id != s.@community_id; END; - // main loop - WHILE @@sum_cc_change > 0 LIMIT maximum_iteration DO - // initialize for iteration - @@sum_cc_change = 0; - Start = SELECT s - FROM Start:s - WHERE s.@sum_outdegree > 1 + // Coarsening + UINT new_layer = 0; + @@community_sum_total_map.clear(); + Tmp = SELECT s + FROM Pass_Nodes:s -(e_type_set:e)- :t + ACCUM IF s.@community_id == t.@community_id THEN + @@community_sum_in_map += (s.@community_id -> e.getAttr(weight_attribute, "DOUBLE")) + END + POST-ACCUM + VERTEX cid = s.@community_id, + INSERT INTO belongs_to VALUES(s, cid, new_layer), + IF @@community_sum_in_map.containsKey(s) THEN + INSERT INTO links_to VALUES(s, s, (new_layer -> @@community_sum_in_map.get(s))) + END; + @@community_sum_in_map.clear(); + Tmp = SELECT s + FROM Pass_Nodes:s -(e_type_set:e)- :t + ACCUM IF s.@community_id != t.@community_id THEN + @@source_target_k_in_map += (s.@community_id -> (t.@community_id -> e.getAttr(weight_attribute, "DOUBLE"))) + END + POST-ACCUM + IF @@source_target_k_in_map.containsKey(s) THEN + FOREACH (target_community, k_in) IN @@source_target_k_in_map.get(s) DO + INSERT INTO links_to VALUES(s, target_community, (new_layer -> k_in)) + END + END; + @@source_target_k_in_map.clear(); + + // -------------------- 2. Remaining passes -------------------- + SumAccum @@sum; + INT layer = 0; + WHILE layer < total_passes_count - 1 DO + // Reset + Tmp = SELECT s + FROM Pass_Nodes:s -(links_to:e)- :t + ACCUM @@sum += 1 + POST-ACCUM // Reset + s.@k = 0, + s.@k_in = 0, + s.@k_self_loop = 0, + s.@best_move = MyTuple(@@min_double, s); + // Initialization + Pass_Nodes = SELECT s + FROM Pass_Nodes:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + ACCUM DOUBLE weight = e.layer_weight_map.get(layer), + s.@k += weight, + IF s == t THEN // Self-loop link + s.@k_self_loop += weight + END + POST-ACCUM + s.@community_id = s; + IF @@m < 0.00000000001 THEN + PRINT "Warning: the sum of the weights in the edges should be greater than zero!"; + RETURN; + END; + + // Local moving + INT hop = 0; + Candidates = Pass_Nodes; + WHILE Candidates.size() > 0 AND hop < maximum_iteration DO + hop = hop + 1; + IF hop == 1 THEN // First iteration + ChangedNodes = SELECT s + FROM Candidates:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + AND s.@community_id != t.@community_id + ACCUM s.@best_move += MyTuple(1 - s.@k * t.@k / (2 * @@m), t.@community_id) + POST-ACCUM + IF s.@best_move.delta_Q_add > 0 THEN // The gain (delta Q) is positive + s.@to_change_community = TRUE + END + HAVING s.@to_change_community == TRUE; + ELSE // Remaining iterations + // Calculate sum_total + Tmp = SELECT s + FROM Pass_Nodes:s POST-ACCUM - s.@sum_ac = 0, - s.@cm_list.clear(), - s.@A_map.clear(); - - Start = SELECT s - FROM Start:s - ACCUM - FOREACH v IN s.@cc_list DO - CASE WHEN getvid(v) != -1 THEN - v.@cm_list += s - END - END; - - Start = SELECT s - FROM Start:s -(e_type_set:e)- :t - WHERE t.@sum_outdegree > 1 - ACCUM - s.@A_map += (t.@cc_list.get(0) -> e.getAttr(weight_attribute, "FLOAT")*1.0); - - Start = SELECT s - FROM Start:s - ACCUM - FOREACH v IN s.@cc_list DO - CASE WHEN getvid(v) != -1 THEN - v.@sum_ac += s.@sum_weight - END - END; - - Start = SELECT s - FROM Start:s - ACCUM - FOREACH v IN s.@cm_list DO - CASE WHEN getvid(v) != -1 THEN - v.@sum_ac = s.@sum_ac - END - END; - - // compute @max_dQ - Start = SELECT s - FROM Start:s -(e_type_set:e)- :t - WHERE t.@sum_outdegree > 1 - ACCUM - INT A_s = 0, - IF s.@A_map.containsKey(s) THEN - A_s = s.@A_map.get(s) - END, - s.@max_best_move += move(s.@A_map.get(t.@cc_list.get(0)) - A_s + - 1/@@sum_m*s.@sum_weight*(s.@sum_ac-t.@sum_ac), -t.@sum_cc_weight, t.@cc_list.get(0)) + @@community_sum_total_map += (s.@community_id -> s.@k); + Tmp = SELECT s + FROM Pass_Nodes:s POST-ACCUM - IF s.@max_best_move.deltaQ > 0 THEN - IF -s.@max_best_move.weight < s.@sum_cc_weight THEN // smallest best_move weight < current weight - s.@cc_list.clear(), - s.@cc_list += s.@max_best_move.cc, - s.@sum_cc_weight = -s.@max_best_move.weight, - @@sum_cc_change += 1 - ELSE - IF -s.@max_best_move.weight == s.@sum_cc_weight AND getvid(s.@cc_list.get(0)) < getvid(s.@max_best_move.cc) THEN - s.@cc_list.clear(), - s.@cc_list += s.@max_best_move.cc, - s.@sum_cc_weight = -s.@max_best_move.weight, - @@sum_cc_change += 1 - END - END - END; - IF print_stats THEN - PRINT @@sum_cc_change AS IterChangeCount; + s.@community_sum_total = @@community_sum_total_map.get(s.@community_id); + @@community_sum_total_map.clear(); + // Find the best move + ChangedNodes = {}; + // Calculate the delta Q to remove the node from the previous community + Nodes = SELECT s + FROM Candidates:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + ACCUM DOUBLE weight = e.layer_weight_map.get(layer), + IF s.@community_id == t.@community_id THEN + s.@k_in += weight + ELSE + s.@community_k_in_map += (t.@community_id -> weight) + END + POST-ACCUM + s.@delta_Q_remove = 2 * s.@k_self_loop - 2 * s.@k_in + s.@k * (s.@community_sum_total - s.@k) / @@m, + s.@k_in = 0, + s.@best_move = MyTuple(@@min_double, s); // Reset the delta_Q_add + // Find the best move + Nodes = SELECT s + FROM Nodes:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + AND s.@community_id != t.@community_id + ACCUM DOUBLE delta_Q_add = 2 * s.@community_k_in_map.get(t.@community_id) - s.@k * t.@community_sum_total / @@m, + s.@best_move += MyTuple(delta_Q_add, t.@community_id) + POST-ACCUM + IF s.@delta_Q_remove + s.@best_move.delta_Q_add > 0 THEN // The gain (delta Q) is positive + s.@to_change_community = TRUE + END, + s.@community_k_in_map.clear() + HAVING s.@to_change_community == TRUE; + ChangedNodes = ChangedNodes UNION Nodes; END; - END; + // If two nodes swap, only change the community of one of them + SwapNodes = SELECT s + FROM ChangedNodes:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + AND s.@best_move.community == t.@community_id + AND t.@to_change_community == TRUE + AND t.@best_move.community == s.@community_id + // Only change the one with larger delta Q or the one with smaller @vid if delta Q are the same + AND (s.@delta_Q_remove + s.@best_move.delta_Q_add < t.@delta_Q_remove + t.@best_move.delta_Q_add + OR (abs((s.@delta_Q_remove + s.@best_move.delta_Q_add) - (t.@delta_Q_remove + t.@best_move.delta_Q_add)) < 0.00000000001 + AND s.@vid > t.@vid)) + POST-ACCUM + s.@to_change_community = FALSE; + ChangedNodes = ChangedNodes MINUS SwapNodes; + // Place each node of ChangedNodes in the community in which the gain is maximum + ChangedNodes = SELECT s + FROM ChangedNodes:s + POST-ACCUM + s.@community_id = s.@best_move.community, + s.@to_change_community = FALSE; + // Get all neighbours of the changed node that do not belong to the node’s new community + Candidates = SELECT t + FROM ChangedNodes:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + AND t.@community_id != s.@community_id; + END; - // process node with outdegree=1 - // follow the vertex to its neighbor's community - // if the neighbor also have outdegree=1, mark the two vertices as one community - Start = {v_type_set}; - Start = SELECT s - FROM Start:s -(e_type_set:e)- :t - WHERE s.@sum_outdegree == 1 AND t.@sum_outdegree != 1 - ACCUM - s.@cc_list += t.@cc_list.get(0); - IF print_stats THEN - PRINT Start.size() AS VertexFollowedToCommunity; + // Coarsening + UINT new_layer = layer + 1; + @@community_sum_total_map.clear(); + Tmp = SELECT s + FROM Pass_Nodes:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + ACCUM IF s.@community_id == t.@community_id THEN + DOUBLE weight = e.layer_weight_map.get(layer), + @@community_sum_in_map += (s.@community_id -> weight) + END + POST-ACCUM + VERTEX cid = s.@community_id, + INSERT INTO belongs_to VALUES(s, cid, new_layer), + IF @@community_sum_in_map.containsKey(s) THEN + INSERT INTO links_to VALUES(s, s, (new_layer -> @@community_sum_in_map.get(s))) + END; + @@community_sum_in_map.clear(); + Tmp = SELECT s + FROM Pass_Nodes:s -(links_to:e)- :t + WHERE e.layer_weight_map.containsKey(layer) + ACCUM DOUBLE weight = e.layer_weight_map.get(layer), + IF s.@community_id != t.@community_id THEN + @@source_target_k_in_map += (s.@community_id -> (t.@community_id -> weight)) + END + POST-ACCUM + IF @@source_target_k_in_map.containsKey(s) THEN + FOREACH (target_community, k_in) IN @@source_target_k_in_map.get(s) DO + INSERT INTO links_to VALUES(s, target_community, (new_layer -> k_in)) + END + END; + @@source_target_k_in_map.clear(); + layer = layer + 1; END; - Start = {v_type_set}; - Start = SELECT s - FROM Start:s -(e_type_set:e)- :t - WHERE s.@sum_outdegree == 1 AND t.@sum_outdegree == 1 - ACCUM - IF getvid(s) <= getvid(t) THEN - s.@cc_list += s - ELSE - s.@cc_list += t - END; - IF print_stats THEN - PRINT Start.size() AS VertexFollowedToVertex; - END; + // -------------------- 3. Final community and output -------------------- + // Top layer + layer = total_passes_count - 1; + Nodes = SELECT s + FROM All_Nodes:s -(belongs_to>:e)- :t + WHERE layer IN e.layer_set + ACCUM s.@community_id = t; - // process node with outdegree=0 - // assign them to communities containing only itself - Start = {v_type_set}; - Start = SELECT s - FROM Start:s - WHERE s.@sum_outdegree == 0 - ACCUM - s.@cc_list += s; - IF print_stats THEN - PRINT Start.size() AS VertexAssignedToItself; + // Other layers + WHILE Nodes.size() > 0 AND layer > 0 DO + layer = layer - 1; + Nodes = SELECT s + FROM All_Nodes:s -(belongs_to>:e)- :t + WHERE layer IN e.layer_set + ACCUM s.@community_id = t.@community_id; END; - // save result - Start = {v_type_set}; - Start = SELECT s - FROM Start:s + // Output results + Nodes = SELECT s + FROM All_Nodes:s POST-ACCUM - IF result_attribute != "" THEN - s.setAttr(result_attribute, getvid(s.@cc_list.get(0))) - END, - IF file_path != "" THEN - f.println(s, getvid(s.@cc_list.get(0))) - END; - - // print result satistic - IF print_stats THEN - Start = SELECT s - FROM Start:s - WHERE s.@cc_list.size() > 0 - POST-ACCUM - @@community_map += (getvid(s.@cc_list.get(0)) -> 1); - PRINT @@community_map.size() AS FinalCommunityCount; - END; + IF result_attribute != "" THEN + s.setAttr(result_attribute, getvid(s.@community_id)) + END, + IF file_path != "" THEN + VERTEX node = s.@community_id, + f.println(s.type, s, node.type, node) + END; } diff --git a/UDF/tg_ExprFunctions.hpp b/UDF/tg_ExprFunctions.hpp index 79c330e9..13f7637e 100644 --- a/UDF/tg_ExprFunctions.hpp +++ b/UDF/tg_ExprFunctions.hpp @@ -440,6 +440,21 @@ namespace UDIMPL { /* =========== END APPROXIMATE NEAREST NEIGHBORS ============= */ + /* ============== START Milvus ===== */ + inline ListAccum tg_searchInMilvus( + const std::string milvus_host, int milvus_port, const std::string& collection_name, + const std::string& vector_field_name, const std::string& vertex_id_field_name, const std::string& query_vector_str, + const std::string& metric_type, int top_k) { + + tg::tg_MilvusUtil milvus_util(milvus_host, milvus_port); + + // Convert query vector string to std::vector + std::vector query_vector = milvus_util.stringToFloatVector(query_vector_str); + + std::cout << "Beginning the search on: " << collection_name << std::endl; + return milvus_util.search(collection_name, vector_field_name, vertex_id_field_name, query_vector, metric_type, top_k); + } + /* ============== END Milvus ===== */ } /****************************************/ diff --git a/UDF/tg_ExprUtil.hpp b/UDF/tg_ExprUtil.hpp index 21a432bf..9d9d906b 100644 --- a/UDF/tg_ExprUtil.hpp +++ b/UDF/tg_ExprUtil.hpp @@ -38,6 +38,7 @@ #include #include #include +#include namespace tg { @@ -638,6 +639,130 @@ namespace tg { /* ============ END NODE2VEC =============== */ + /* ============== START Milvus =========== */ + class tg_MilvusUtil { + public: + tg_MilvusUtil(const std::string& host, int port) { + this->host = host; + this->port = port; + curl_global_init(CURL_GLOBAL_ALL); + } + + ~tg_MilvusUtil() { + curl_global_cleanup(); + } + + std::vector stringToFloatVector(const std::string& str, char delimiter = ',') { + std::vector result; + std::stringstream ss(str); + std::string item; + + while (std::getline(ss, item, delimiter)) { + try { + result.push_back(std::stof(item)); + } catch (const std::invalid_argument& ia) { + std::cerr << "Invalid argument: " << ia.what() << '\n'; + } catch (const std::out_of_range& oor) { + std::cerr << "Out of Range error: " << oor.what() << '\n'; + } + } + + return result; + } + + ListAccum search(const std::string& collection_name, const std::string& vector_field_name, + const std::string& vertex_id_field_name, const std::vector& query_vector, const std::string& metric_type, int top_k) const { + ListAccum vertexIdList; + + Json::Value search_body; + search_body["collectionName"] = collection_name; + + // Convert query_vector to Json::Value format + for (const auto& val : query_vector) { + search_body["vector"].append(val); + } + + search_body["outputFields"] = Json::arrayValue; + search_body["outputFields"].append("pk"); + search_body["outputFields"].append(vertex_id_field_name); + search_body["limit"] = top_k; + + // You may need to adjust 'search_body' to match the exact format expected by your Milvus server version + + CURL* curl = curl_easy_init(); + if (curl) { + CURLcode res; + std::string readBuffer; + std::string url; + + if (host.substr(0, 4) == "http" && host.find(":") != std::string::npos && host.find(std::to_string(port)) != std::string::npos) { + url = host + "/v1/vector/search"; + } else if (host.substr(0, 4) == "http") { + url = host + ":" + std::to_string(port) + "/v1/vector/search"; + } else { + url = "http://" + host + ":" + std::to_string(port) + "/v1/vector/search"; + } + + Json::StreamWriterBuilder writerBuilder; + std::string requestBody = Json::writeString(writerBuilder, search_body); + + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_POST, 1L); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, requestBody.c_str()); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + + struct curl_slist *headers = NULL; + headers = curl_slist_append(headers, "Content-Type: application/json"); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + + res = curl_easy_perform(curl); + if (res != CURLE_OK) { + std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl; + } else { + Json::CharReaderBuilder readerBuilder; + Json::Value json_response; + std::unique_ptr const reader(readerBuilder.newCharReader()); + std::string parseErrors; + + bool parsingSuccessful = reader->parse(readBuffer.c_str(), readBuffer.c_str() + readBuffer.size(), &json_response, &parseErrors); + + if (parsingSuccessful) { + std::cout << "JSON successfully parsed" << std::endl; + } else { + // If parsing was unsuccessful, print the errors encountered + std::cerr << "Failed to parse JSON: " << parseErrors << std::endl; + } + + if (parsingSuccessful) { + for (const auto& item : json_response["data"]) { + std::string pk = item["pk"].asString(); + std::string vertex_id_str = item[vertex_id_field_name].asString(); + std::cout << "Vector ID: " << pk << "\tVertex ID: " << vertex_id_str << std::endl; + vertexIdList += vertex_id_str; + } + } + } + + curl_easy_cleanup(curl); + curl_slist_free_all(headers); + } + + return vertexIdList; + } + + private: + std::string host; + int port; + + static size_t WriteCallback(void *contents, size_t size, size_t nmemb, std::string *userp) { + userp->append((char*)contents, size * nmemb); + return size * nmemb; + } + }; + + /* ============== END Milvus =========== */ + /* ============== START A STAR =========== */ inline float rad(float d) { diff --git a/algorithms/Centrality/degree/unweighted/tg_degree_cent.gsql b/algorithms/Centrality/degree/unweighted/tg_degree_cent.gsql index e3efb225..fffd3f06 100644 --- a/algorithms/Centrality/degree/unweighted/tg_degree_cent.gsql +++ b/algorithms/Centrality/degree/unweighted/tg_degree_cent.gsql @@ -1,70 +1,71 @@ -CREATE QUERY tg_degree_cent(SET v_type_set, SET e_type_set, SET reverse_e_type_set, BOOL in_degree = TRUE, BOOL out_degree = TRUE, - INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "") SYNTAX V1 { - +CREATE QUERY tg_degree_cent(SET v_type_set, SET e_type_set, SET reverse_e_type_set, BOOL in_degree = TRUE, BOOL out_degree = TRUE, INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "", BOOL normalize = TRUE) SYNTAX V1 { /* - First Author: - First Commit Date: - - Recent Author: - Recent Commit Date: + First Author: + First Commit Date: + Recent Author: Rob Rossmiller + Recent Commit Date: 05/2024 - Repository: - https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Centrality - Maturity: - Production + Repository: + https://github.com/tigergraph/gsql-graph-algorithms/tree/master/algorithms/Centrality - Description: - Compute degree Centrality for each VERTEX. - for undirected graph, you only need to set e_type_set and indegree + Maturity: + Production - Publications: - NA + Description: + Compute degree Centrality for each VERTEX. + for undirected graph, you only need to set e_type_set and indegree - TigerGraph Documentation: - https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/degree-centrality + Publications: + NA - Parameters: - v_type_set: - vertex types to traverse - e_type_set: - edge types to traverse - reverse_e_type_set: - for indegree use - in_degree: - If True, count incoming relationships - out_degree: - If True, count outcoming relationships - top_k: - report only this many top scores - print_results: - If True, print the result - result_attribute: - attribute to write result to - file_path: - file to write CSV output to + TigerGraph Documentation: + https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/degree-centrality + Parameters: + v_type_set: + vertex types to traverse + e_type_set: + edge types to traverse + reverse_e_type_set: + for indegree use + in_degree: + If True, count incoming relationships + out_degree: + If True, count outcoming relationships + top_k: + report only this many top scores + print_results: + If True, print the result + result_attribute: + attribute to write result to + file_path: + file to write CSV output to + normailize: + If True, return the normalized centrality. Default: True */ TYPEDEF TUPLE Vertex_Score; HeapAccum(top_k, score DESC) @@top_scores_heap; - SumAccum @sum_degree_score; + SumAccum @sum_degree_score; FILE f (file_path); all = {v_type_set}; sll = SELECT s FROM all:s - ACCUM IF in_degree THEN - FOREACH edge_type in reverse_e_type_set DO - s.@sum_degree_score+=s.outdegree(edge_type) - END - END, - IF out_degree THEN - FOREACH edge_type in e_type_set DO - s.@sum_degree_score+=s.outdegree(edge_type) - END - END; + ACCUM + IF in_degree THEN + s.@sum_degree_score += s.outdegree(reverse_e_type_set) + END, + IF out_degree THEN + s.@sum_degree_score += s.outdegree(e_type_set) + END + POST-ACCUM + IF normalize THEN + s.@sum_degree_score = s.@sum_degree_score / (all.size() - 1) + END; + #Output IF file_path != "" THEN f.println("Vertex_ID", "Degree"); diff --git a/algorithms/Centrality/degree/weighted/tg_weighted_degree_cent.gsql b/algorithms/Centrality/degree/weighted/tg_weighted_degree_cent.gsql index a284380b..6876f371 100644 --- a/algorithms/Centrality/degree/weighted/tg_weighted_degree_cent.gsql +++ b/algorithms/Centrality/degree/weighted/tg_weighted_degree_cent.gsql @@ -1,5 +1,4 @@ -CREATE QUERY tg_weighted_degree_cent(STRING v_type, STRING e_type, STRING reverse_e_type, string weight_attribute, BOOL in_degree = TRUE, BOOL out_degree = TRUE, INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "") SYNTAX V1 { - +CREATE QUERY tg_weighted_degree_cent(STRING v_type, STRING e_type, STRING reverse_e_type, STRING weight_attribute, BOOL in_degree = TRUE, BOOL out_degree = TRUE, INT top_k=100, BOOL print_results = TRUE, STRING result_attribute = "",STRING file_path = "") SYNTAX V1 { /* First Author: First Commit Date: @@ -22,18 +21,20 @@ CREATE QUERY tg_weighted_degree_cent(STRING v_type, STRING e_type, STRING revers for undirected graph, you only need to set e_type and in_degree Publications: - + NA TigerGraph Documentation: - + https://docs.tigergraph.com/graph-ml/current/centrality-algorithms/weighted-degree-centrality Parameters: v_type: - vertex types to traverse + Vertex types to traverse e_type: - edge types to traverse + Edge types to traverse reverse_e_type: - for indegree use + For indegree use + weight_attribute: + The edge weight attribute name in_degree: If True, count incoming relationships out_degree: @@ -43,27 +44,28 @@ CREATE QUERY tg_weighted_degree_cent(STRING v_type, STRING e_type, STRING revers print_results: If True, print the results result_attribute: - attribute to write result to + Attribute to write result to file_path: - file to write CSV output to - */ + File to write CSV output to + */ TYPEDEF TUPLE Vertex_Score; HeapAccum(top_k, score DESC) @@top_scores_heap; - SumAccum @sum_degree_score; + SumAccum @sum_degree_score; FILE f (file_path); all = {v_type}; IF in_degree THEN sll = SELECT s - FROM all:s-(reverse_e_type:e)-:t - ACCUM s.@sum_degree_score+=e.getAttr(weight_attribute,"INT"); + FROM all:s -(reverse_e_type:e)- :t + ACCUM s.@sum_degree_score += e.getAttr(weight_attribute, "FLOAT"); END; IF out_degree THEN sll = SELECT s - FROM all:s-(e_type:e)-:t - ACCUM s.@sum_degree_score+=e.getAttr(weight_attribute,"INT"); + FROM all:s -(e_type:e)- :t + ACCUM s.@sum_degree_score += e.getAttr(weight_attribute, "FLOAT"); END; + #Output IF file_path != "" THEN f.println("Vertex_ID", "Degree"); @@ -72,17 +74,17 @@ CREATE QUERY tg_weighted_degree_cent(STRING v_type, STRING e_type, STRING revers Start = SELECT s FROM all:s POST-ACCUM - IF result_attribute != "" THEN - s.setAttr(result_attribute, s.@sum_degree_score) - END, - - IF print_results THEN - @@top_scores_heap += Vertex_Score(s, s.@sum_degree_score) - END, - - IF file_path != "" THEN - f.println(s, s.@sum_degree_score) - END; + IF result_attribute != "" THEN + s.setAttr(result_attribute, s.@sum_degree_score) + END, + + IF print_results THEN + @@top_scores_heap += Vertex_Score(s, s.@sum_degree_score) + END, + + IF file_path != "" THEN + f.println(s, s.@sum_degree_score) + END; IF print_results THEN PRINT @@top_scores_heap AS top_scores; diff --git a/tests/CONTRIBUTING.md b/tests/CONTRIBUTING.md new file mode 100644 index 00000000..a4b05fcd --- /dev/null +++ b/tests/CONTRIBUTING.md @@ -0,0 +1,171 @@ +# Contribution Guidelines for Adding Tests + +### Contents + +- [Running the tests](#running-the-tests) +- [Directory Layout](#directory-layout) +- [Adding tests](#adding-tests) +- [Available Graphs](#available-graphs) + +## Running the tests + +Execute the following to download the dependencies and run the tests. Make sure you're in a venv. + +```sh +echo ' +HOST_NAME="https://tg-hostname" +USER_NAME=tigergraph +PASS=tigergraph +' >> test/.env +pip install -r requirements.txt +./run.sh +``` + +`test/.env` + +- HOST_NAME: A TG environment that you have querywriter access to so setup.py can load data and queries to a subgraph named `graph_algorithms_testing` +- USER_NAME: user +- PASS: user's password + +`run.sh` does a few things: + +- runs the setup script to make sure the graphs are created and data is loaded +- runs `test/create_baseline.py` + - this creates the baselines for the algorithm types listed in that file +- runs the tests with pytest + +## Directory layout + +`data`: stores the satic data for creating graphs, and algorithm baseline results. + +- CSV files under `data/[heterogeneous_edges, unweighted_edges, weighted_edges]` store the adjacency information for creating graphs. The baselines for algorithms are made from these graphs + - For example `data/weighted_edges/line_edges.csv` stores the edges and weights to create a weighted, line graph. +- JSON files under `data/baseline` store the baseline results for a given algorithm on a given graph type. + - For example `data/baseline/centrality/pagerank/Line_Directed.json` stores the baseline results for pagerank on a directed line graph + +Some data (like the Cora graph) comes from [pyTigerGraph Datasets](https://docs.tigergraph.com/pytigergraph/current/datasets/datasets_object), so it will not be in the this path. + +test: + +- setup.py: creates the graph, loads the data and installs the queries from pyTG's featurizer. Any new/custom queries need to be manually installed +- create_baseline.py: creates the baselines the algorithms will be compared to. +- test.py: houses the testing code for each family of algorithms + +``` +├── data +│   ├── baseline +│   │   ├── +│   │   │   └── +│   │ │ └── .json +│   ├── +│   │ └── .csv +├── requirements.txt +├── run.sh +├── test +│   ├── pyrightconfig.json +│   ├── setup.py +│   ├── baseline/ +│ │   ├── algos/ +│ │ │ └── .py +│ │ └── .py +│   ├── test_centrality.py +│   ├── test_community.py +│   ├── test_path_finding.py +│   ├── ... +│   └── util.py +``` + +## Adding tests + +Start with creating the baseline. Add a method call to `create_baseline.py` that creates a baseline for all the necessary graph types for your algorithm. The output of the baseline should be written to +the correct path in `data/baseline` (see above [layout](#directory-layout)). + +If you're adding a new algorithm, add a test method to the algorithm family that it belongs to (i.e., community algorigthms go in community.py). The first test method in `test/test_centrality.py` +is a good template to follow: + +```py + # this function will run once for each of the graph names in the undirected_graphs list + @pytest.mark.parametrize("test_name", undirected_graphs) + def test_degree_centrality1(self, test_name): + # query params + params = { + "v_type_set": ["V20"], + "e_type_set": [test_name], + "reverse_e_type_set": [test_name], + "in_degree": True, + "out_degree": False, + "top_k": 100, + "print_results": True, + "result_attribute": "", + "file_path": "", + } + with open(f"data/baseline/centrality/degree_centrality/{test_name}.json") as f: + baseline = json.load(f) + baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) + + # call the the algorithm through the featurizer + result = self.feat.runAlgorithm("tg_degree_cent", params=params) + result = sorted(result[0]["top_scores"], key=lambda x: x["Vertex_ID"]) + + + # check that the results agree with the baseline + for b in baseline: + for r in result: + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') +``` + +## Available Graphs + +Example usage: + +- If you want to run a query on a directed, weighted, line graph, use the V20 verts and Line_Directed_Weighted edges. + +| Graph | Type | Vertices | Edges | +| --------------------------- | ------------------------------------------------------------ | -------- | -------------------------------- | +| Null | | V0 | | +| Single node | | V1 | | +| Empty graph | Undirected | V20 | Empty | +| | Directed | | Empty_Directed | +| Line | Undirected, unweighted | V20 | Line | +| | Directed, unweighted | | Line_Directed | +| | Undirected, weighted | | Line_Weighted | +| | Directed, weighted | | Line_Directed_Weighted | +| | Heterogeneous vertex types, directed, weighted | V20, V8 | Line_Heterogeneous | +| Ring | Undirected, unweighted | V20 | Ring | +| | Directed, unweighted | | Ring_Directed | +| | Undirected, weighted | | Ring_Weighted | +| | Directed, weighted | | Ring_Directed_Weighted | +| | Heterogeneous vertex types, directed, weighted | V20, V8 | Ring_Heterogeneous | +| Hub & spoke | Undirected, unweighted | V20 | Hub_Spoke | +| | Directed (towards the spokes), unweighted Hub_Spoke_Directed | | | +| | Undirected, weighted Hub_Spoke_Weighted | | | +| | Directed, weighted Hub_Spoke_Directed_Weighted | | | +| | Heterogeneous vertex types, directed, weighted | V20, V8 | Hub_Spoke_Heterogeneous | +| Hub-connected hub & spoke | Undirected, unweighted | V20 | Hub_Connected_Hub_Spoke | +| | Undirected, weighted | | Hub_Connected_Hub_Spoke_Weighted | +| Tree | Undirected, unweighted | V20 | Tree | +| | Directed, unweighted | | Tree_Directed | +| | Undirected, weighted | | Tree_Weighted | +| | Directed, weighted | | Tree_Directed_Weighted | +| | Heterogeneous vertex types, directed, weighted | V20, V8 | Tree_Heterogeneous | +| Complete | Undirected, unweighted | V8 | Complete | +| | Directed, unweighted | | Complete_Directed | +| | Undirected, weighted | | Complete_Weighted | +| | Directed, weighted | | Complete_Directed_Weighted | +| | Heterogeneous vertex types, directed, weighted | V4, V8 | Complete_Heterogeneous | +| DAG | Directed, unweighted | V20 | DAG_Directed | +| | Directed, weighted | | DAG_Directed_Weighted | +| | Heterogeneous vertex types, directed, weighted | V20, V8 | DAG_Heterogeneous | +| Graph with negative cycles | Directed, weighted | V20 | Negative_cycles | +| | Heterogeneous vertex types, directed, weighted | V20, V8 | Negative_Cycle_Heterogeneous | +| Topological link prediction | Unweighted, undirected | V8 | topo_link1 | +| | topo_link2 | | | +| | topo_link3 | | | +| | topo_link4 | | | +| | topo_link5 | | | +| | topo_link6 | | | +| | Unweighted, directed | | topo_link_directed | +| Same Community | no edges | V4 | | diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..a1f8abc2 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,6 @@ +# Algorithm Testing + +[networkX](https://networkx.org/documentation/stable/reference/index.html) is used as +the baseline for our tests where we can. + +A peculiarity to note about nx is that it counts self edges in undirected graphs as two separate edges. So, you'll see that some baselines use a modified version of the code that is found within nx. Take `run_degree_baseline_complete`, which generates the baseline for degree centrality on complete graphs. It uses the same code that can be found in `nx.centrality.degree_centrality` with the exception of subtracting a node's degree by one. diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Empty.json b/tests/data/baseline/centrality/article_rank/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Empty.json rename to tests/data/baseline/centrality/article_rank/Empty.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Hub_Spoke.json b/tests/data/baseline/centrality/article_rank/Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Hub_Spoke.json rename to tests/data/baseline/centrality/article_rank/Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Hub_Spoke_Directed.json b/tests/data/baseline/centrality/article_rank/Hub_Spoke_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Hub_Spoke_Directed.json rename to tests/data/baseline/centrality/article_rank/Hub_Spoke_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Line.json b/tests/data/baseline/centrality/article_rank/Line.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Line.json rename to tests/data/baseline/centrality/article_rank/Line.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Line_Directed.json b/tests/data/baseline/centrality/article_rank/Line_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Line_Directed.json rename to tests/data/baseline/centrality/article_rank/Line_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Ring.json b/tests/data/baseline/centrality/article_rank/Ring.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Ring.json rename to tests/data/baseline/centrality/article_rank/Ring.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Ring_Directed.json b/tests/data/baseline/centrality/article_rank/Ring_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Ring_Directed.json rename to tests/data/baseline/centrality/article_rank/Ring_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Tree.json b/tests/data/baseline/centrality/article_rank/Tree.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Tree.json rename to tests/data/baseline/centrality/article_rank/Tree.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Tree_Directed.json b/tests/data/baseline/centrality/article_rank/Tree_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/article_rank/Tree_Directed.json rename to tests/data/baseline/centrality/article_rank/Tree_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Empty.json b/tests/data/baseline/centrality/closeness_centrality/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Empty.json rename to tests/data/baseline/centrality/closeness_centrality/Empty.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Hub_Spoke.json b/tests/data/baseline/centrality/closeness_centrality/Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Hub_Spoke.json rename to tests/data/baseline/centrality/closeness_centrality/Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Hub_Spoke_Directed.json b/tests/data/baseline/centrality/closeness_centrality/Hub_Spoke_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Hub_Spoke_Directed.json rename to tests/data/baseline/centrality/closeness_centrality/Hub_Spoke_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Line.json b/tests/data/baseline/centrality/closeness_centrality/Line.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Line.json rename to tests/data/baseline/centrality/closeness_centrality/Line.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Line_Directed.json b/tests/data/baseline/centrality/closeness_centrality/Line_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Line_Directed.json rename to tests/data/baseline/centrality/closeness_centrality/Line_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Ring.json b/tests/data/baseline/centrality/closeness_centrality/Ring.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Ring.json rename to tests/data/baseline/centrality/closeness_centrality/Ring.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Ring_Directed.json b/tests/data/baseline/centrality/closeness_centrality/Ring_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Ring_Directed.json rename to tests/data/baseline/centrality/closeness_centrality/Ring_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Tree.json b/tests/data/baseline/centrality/closeness_centrality/Tree.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Tree.json rename to tests/data/baseline/centrality/closeness_centrality/Tree.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Tree_Directed.json b/tests/data/baseline/centrality/closeness_centrality/Tree_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/Tree_Directed.json rename to tests/data/baseline/centrality/closeness_centrality/Tree_Directed.json diff --git a/tests/data/baseline/centrality/degree_centrality/Complete.json b/tests/data/baseline/centrality/degree_centrality/Complete.json new file mode 100644 index 00000000..98255ee1 --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/Complete.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 1.1428571428571428}, {"Vertex_ID": "B", "score": 1.1428571428571428}, {"Vertex_ID": "C", "score": 1.1428571428571428}, {"Vertex_ID": "D", "score": 1.1428571428571428}, {"Vertex_ID": "E", "score": 1.1428571428571428}, {"Vertex_ID": "F", "score": 1.1428571428571428}, {"Vertex_ID": "G", "score": 1.1428571428571428}, {"Vertex_ID": "H", "score": 1.1428571428571428}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Empty.json b/tests/data/baseline/centrality/degree_centrality/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Empty.json rename to tests/data/baseline/centrality/degree_centrality/Empty.json diff --git a/tests/data/baseline/centrality/degree_centrality/Hub_Spoke.json b/tests/data/baseline/centrality/degree_centrality/Hub_Spoke.json new file mode 100644 index 00000000..b97010da --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/Hub_Spoke.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 1.0}, {"Vertex_ID": "B", "score": 0.05263157894736842}, {"Vertex_ID": "C", "score": 0.05263157894736842}, {"Vertex_ID": "D", "score": 0.05263157894736842}, {"Vertex_ID": "E", "score": 0.05263157894736842}, {"Vertex_ID": "F", "score": 0.05263157894736842}, {"Vertex_ID": "G", "score": 0.05263157894736842}, {"Vertex_ID": "H", "score": 0.05263157894736842}, {"Vertex_ID": "I", "score": 0.05263157894736842}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/Line.json b/tests/data/baseline/centrality/degree_centrality/Line.json new file mode 100644 index 00000000..70ee11a4 --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/Line.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.05263157894736842}, {"Vertex_ID": "B", "score": 0.10526315789473684}, {"Vertex_ID": "C", "score": 0.10526315789473684}, {"Vertex_ID": "D", "score": 0.10526315789473684}, {"Vertex_ID": "E", "score": 0.10526315789473684}, {"Vertex_ID": "F", "score": 0.10526315789473684}, {"Vertex_ID": "G", "score": 0.10526315789473684}, {"Vertex_ID": "H", "score": 0.10526315789473684}, {"Vertex_ID": "I", "score": 0.10526315789473684}, {"Vertex_ID": "J", "score": 0.10526315789473684}, {"Vertex_ID": "K", "score": 0.10526315789473684}, {"Vertex_ID": "L", "score": 0.10526315789473684}, {"Vertex_ID": "M", "score": 0.10526315789473684}, {"Vertex_ID": "N", "score": 0.10526315789473684}, {"Vertex_ID": "O", "score": 0.10526315789473684}, {"Vertex_ID": "P", "score": 0.10526315789473684}, {"Vertex_ID": "Q", "score": 0.10526315789473684}, {"Vertex_ID": "R", "score": 0.10526315789473684}, {"Vertex_ID": "S", "score": 0.10526315789473684}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/Ring.json b/tests/data/baseline/centrality/degree_centrality/Ring.json new file mode 100644 index 00000000..1f77b5bc --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/Ring.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.10526315789473684}, {"Vertex_ID": "B", "score": 0.10526315789473684}, {"Vertex_ID": "C", "score": 0.10526315789473684}, {"Vertex_ID": "D", "score": 0.10526315789473684}, {"Vertex_ID": "E", "score": 0.10526315789473684}, {"Vertex_ID": "F", "score": 0.10526315789473684}, {"Vertex_ID": "G", "score": 0.10526315789473684}, {"Vertex_ID": "H", "score": 0.10526315789473684}, {"Vertex_ID": "I", "score": 0.10526315789473684}, {"Vertex_ID": "J", "score": 0.10526315789473684}, {"Vertex_ID": "K", "score": 0.10526315789473684}, {"Vertex_ID": "L", "score": 0.10526315789473684}, {"Vertex_ID": "M", "score": 0.10526315789473684}, {"Vertex_ID": "N", "score": 0.10526315789473684}, {"Vertex_ID": "O", "score": 0.10526315789473684}, {"Vertex_ID": "P", "score": 0.10526315789473684}, {"Vertex_ID": "Q", "score": 0.10526315789473684}, {"Vertex_ID": "R", "score": 0.10526315789473684}, {"Vertex_ID": "S", "score": 0.10526315789473684}, {"Vertex_ID": "T", "score": 0.10526315789473684}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/Tree.json b/tests/data/baseline/centrality/degree_centrality/Tree.json new file mode 100644 index 00000000..51cb839d --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/Tree.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.10526315789473684}, {"Vertex_ID": "B", "score": 0.15789473684210525}, {"Vertex_ID": "C", "score": 0.15789473684210525}, {"Vertex_ID": "D", "score": 0.15789473684210525}, {"Vertex_ID": "E", "score": 0.15789473684210525}, {"Vertex_ID": "F", "score": 0.15789473684210525}, {"Vertex_ID": "G", "score": 0.15789473684210525}, {"Vertex_ID": "H", "score": 0.15789473684210525}, {"Vertex_ID": "I", "score": 0.15789473684210525}, {"Vertex_ID": "J", "score": 0.10526315789473684}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/in_degree/Hub_Spoke_Directed.json b/tests/data/baseline/centrality/degree_centrality/in_degree/Hub_Spoke_Directed.json new file mode 100644 index 00000000..365279a3 --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/in_degree/Hub_Spoke_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.0}, {"Vertex_ID": "B", "score": 0.05263157894736842}, {"Vertex_ID": "C", "score": 0.05263157894736842}, {"Vertex_ID": "D", "score": 0.05263157894736842}, {"Vertex_ID": "E", "score": 0.05263157894736842}, {"Vertex_ID": "F", "score": 0.05263157894736842}, {"Vertex_ID": "G", "score": 0.05263157894736842}, {"Vertex_ID": "H", "score": 0.05263157894736842}, {"Vertex_ID": "I", "score": 0.05263157894736842}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/in_degree/Line_Directed.json b/tests/data/baseline/centrality/degree_centrality/in_degree/Line_Directed.json new file mode 100644 index 00000000..365279a3 --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/in_degree/Line_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.0}, {"Vertex_ID": "B", "score": 0.05263157894736842}, {"Vertex_ID": "C", "score": 0.05263157894736842}, {"Vertex_ID": "D", "score": 0.05263157894736842}, {"Vertex_ID": "E", "score": 0.05263157894736842}, {"Vertex_ID": "F", "score": 0.05263157894736842}, {"Vertex_ID": "G", "score": 0.05263157894736842}, {"Vertex_ID": "H", "score": 0.05263157894736842}, {"Vertex_ID": "I", "score": 0.05263157894736842}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/in_degree/Ring_Directed.json b/tests/data/baseline/centrality/degree_centrality/in_degree/Ring_Directed.json new file mode 100644 index 00000000..62ccb50c --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/in_degree/Ring_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.05263157894736842}, {"Vertex_ID": "B", "score": 0.05263157894736842}, {"Vertex_ID": "C", "score": 0.05263157894736842}, {"Vertex_ID": "D", "score": 0.05263157894736842}, {"Vertex_ID": "E", "score": 0.05263157894736842}, {"Vertex_ID": "F", "score": 0.05263157894736842}, {"Vertex_ID": "G", "score": 0.05263157894736842}, {"Vertex_ID": "H", "score": 0.05263157894736842}, {"Vertex_ID": "I", "score": 0.05263157894736842}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/in_degree/Tree_Directed.json b/tests/data/baseline/centrality/degree_centrality/in_degree/Tree_Directed.json new file mode 100644 index 00000000..365279a3 --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/in_degree/Tree_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.0}, {"Vertex_ID": "B", "score": 0.05263157894736842}, {"Vertex_ID": "C", "score": 0.05263157894736842}, {"Vertex_ID": "D", "score": 0.05263157894736842}, {"Vertex_ID": "E", "score": 0.05263157894736842}, {"Vertex_ID": "F", "score": 0.05263157894736842}, {"Vertex_ID": "G", "score": 0.05263157894736842}, {"Vertex_ID": "H", "score": 0.05263157894736842}, {"Vertex_ID": "I", "score": 0.05263157894736842}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/out_degree/Hub_Spoke_Directed.json b/tests/data/baseline/centrality/degree_centrality/out_degree/Hub_Spoke_Directed.json new file mode 100644 index 00000000..870b88d1 --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/out_degree/Hub_Spoke_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 1.0}, {"Vertex_ID": "B", "score": 0.0}, {"Vertex_ID": "C", "score": 0.0}, {"Vertex_ID": "D", "score": 0.0}, {"Vertex_ID": "E", "score": 0.0}, {"Vertex_ID": "F", "score": 0.0}, {"Vertex_ID": "G", "score": 0.0}, {"Vertex_ID": "H", "score": 0.0}, {"Vertex_ID": "I", "score": 0.0}, {"Vertex_ID": "J", "score": 0.0}, {"Vertex_ID": "K", "score": 0.0}, {"Vertex_ID": "L", "score": 0.0}, {"Vertex_ID": "M", "score": 0.0}, {"Vertex_ID": "N", "score": 0.0}, {"Vertex_ID": "O", "score": 0.0}, {"Vertex_ID": "P", "score": 0.0}, {"Vertex_ID": "Q", "score": 0.0}, {"Vertex_ID": "R", "score": 0.0}, {"Vertex_ID": "S", "score": 0.0}, {"Vertex_ID": "T", "score": 0.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/out_degree/Line_Directed.json b/tests/data/baseline/centrality/degree_centrality/out_degree/Line_Directed.json new file mode 100644 index 00000000..d7e6932f --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/out_degree/Line_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.05263157894736842}, {"Vertex_ID": "B", "score": 0.05263157894736842}, {"Vertex_ID": "C", "score": 0.05263157894736842}, {"Vertex_ID": "D", "score": 0.05263157894736842}, {"Vertex_ID": "E", "score": 0.05263157894736842}, {"Vertex_ID": "F", "score": 0.05263157894736842}, {"Vertex_ID": "G", "score": 0.05263157894736842}, {"Vertex_ID": "H", "score": 0.05263157894736842}, {"Vertex_ID": "I", "score": 0.05263157894736842}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/out_degree/Ring_Directed.json b/tests/data/baseline/centrality/degree_centrality/out_degree/Ring_Directed.json new file mode 100644 index 00000000..62ccb50c --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/out_degree/Ring_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.05263157894736842}, {"Vertex_ID": "B", "score": 0.05263157894736842}, {"Vertex_ID": "C", "score": 0.05263157894736842}, {"Vertex_ID": "D", "score": 0.05263157894736842}, {"Vertex_ID": "E", "score": 0.05263157894736842}, {"Vertex_ID": "F", "score": 0.05263157894736842}, {"Vertex_ID": "G", "score": 0.05263157894736842}, {"Vertex_ID": "H", "score": 0.05263157894736842}, {"Vertex_ID": "I", "score": 0.05263157894736842}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.05263157894736842}, {"Vertex_ID": "L", "score": 0.05263157894736842}, {"Vertex_ID": "M", "score": 0.05263157894736842}, {"Vertex_ID": "N", "score": 0.05263157894736842}, {"Vertex_ID": "O", "score": 0.05263157894736842}, {"Vertex_ID": "P", "score": 0.05263157894736842}, {"Vertex_ID": "Q", "score": 0.05263157894736842}, {"Vertex_ID": "R", "score": 0.05263157894736842}, {"Vertex_ID": "S", "score": 0.05263157894736842}, {"Vertex_ID": "T", "score": 0.05263157894736842}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/degree_centrality/out_degree/Tree_Directed.json b/tests/data/baseline/centrality/degree_centrality/out_degree/Tree_Directed.json new file mode 100644 index 00000000..9471b1db --- /dev/null +++ b/tests/data/baseline/centrality/degree_centrality/out_degree/Tree_Directed.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 0.10526315789473684}, {"Vertex_ID": "B", "score": 0.10526315789473684}, {"Vertex_ID": "C", "score": 0.10526315789473684}, {"Vertex_ID": "D", "score": 0.10526315789473684}, {"Vertex_ID": "E", "score": 0.10526315789473684}, {"Vertex_ID": "F", "score": 0.10526315789473684}, {"Vertex_ID": "G", "score": 0.10526315789473684}, {"Vertex_ID": "H", "score": 0.10526315789473684}, {"Vertex_ID": "I", "score": 0.10526315789473684}, {"Vertex_ID": "J", "score": 0.05263157894736842}, {"Vertex_ID": "K", "score": 0.0}, {"Vertex_ID": "L", "score": 0.0}, {"Vertex_ID": "M", "score": 0.0}, {"Vertex_ID": "N", "score": 0.0}, {"Vertex_ID": "O", "score": 0.0}, {"Vertex_ID": "P", "score": 0.0}, {"Vertex_ID": "Q", "score": 0.0}, {"Vertex_ID": "R", "score": 0.0}, {"Vertex_ID": "S", "score": 0.0}, {"Vertex_ID": "T", "score": 0.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Empty.json b/tests/data/baseline/centrality/harmonic_centrality/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Empty.json rename to tests/data/baseline/centrality/harmonic_centrality/Empty.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Hub_Spoke.json b/tests/data/baseline/centrality/harmonic_centrality/Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Hub_Spoke.json rename to tests/data/baseline/centrality/harmonic_centrality/Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Hub_Spoke_Directed.json b/tests/data/baseline/centrality/harmonic_centrality/Hub_Spoke_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Hub_Spoke_Directed.json rename to tests/data/baseline/centrality/harmonic_centrality/Hub_Spoke_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Line.json b/tests/data/baseline/centrality/harmonic_centrality/Line.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Line.json rename to tests/data/baseline/centrality/harmonic_centrality/Line.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Line_Directed.json b/tests/data/baseline/centrality/harmonic_centrality/Line_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Line_Directed.json rename to tests/data/baseline/centrality/harmonic_centrality/Line_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Ring.json b/tests/data/baseline/centrality/harmonic_centrality/Ring.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Ring.json rename to tests/data/baseline/centrality/harmonic_centrality/Ring.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Ring_Directed.json b/tests/data/baseline/centrality/harmonic_centrality/Ring_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Ring_Directed.json rename to tests/data/baseline/centrality/harmonic_centrality/Ring_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Tree.json b/tests/data/baseline/centrality/harmonic_centrality/Tree.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Tree.json rename to tests/data/baseline/centrality/harmonic_centrality/Tree.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Tree_Directed.json b/tests/data/baseline/centrality/harmonic_centrality/Tree_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/Tree_Directed.json rename to tests/data/baseline/centrality/harmonic_centrality/Tree_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Empty.json b/tests/data/baseline/centrality/pagerank/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Empty.json rename to tests/data/baseline/centrality/pagerank/Empty.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Hub_Spoke.json b/tests/data/baseline/centrality/pagerank/Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Hub_Spoke.json rename to tests/data/baseline/centrality/pagerank/Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Hub_Spoke_Directed.json b/tests/data/baseline/centrality/pagerank/Hub_Spoke_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Hub_Spoke_Directed.json rename to tests/data/baseline/centrality/pagerank/Hub_Spoke_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Line.json b/tests/data/baseline/centrality/pagerank/Line.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Line.json rename to tests/data/baseline/centrality/pagerank/Line.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Line_Directed.json b/tests/data/baseline/centrality/pagerank/Line_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Line_Directed.json rename to tests/data/baseline/centrality/pagerank/Line_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Ring.json b/tests/data/baseline/centrality/pagerank/Ring.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Ring.json rename to tests/data/baseline/centrality/pagerank/Ring.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Ring_Directed.json b/tests/data/baseline/centrality/pagerank/Ring_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Ring_Directed.json rename to tests/data/baseline/centrality/pagerank/Ring_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Tree.json b/tests/data/baseline/centrality/pagerank/Tree.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Tree.json rename to tests/data/baseline/centrality/pagerank/Tree.json diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Tree_Directed.json b/tests/data/baseline/centrality/pagerank/Tree_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/centrality/pagerank/Tree_Directed.json rename to tests/data/baseline/centrality/pagerank/Tree_Directed.json diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/Complete_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/Complete_Weighted.json new file mode 100644 index 00000000..997882ed --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/Complete_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 70.0}, {"Vertex_ID": "B", "score": 36.0}, {"Vertex_ID": "C", "score": 99.0}, {"Vertex_ID": "D", "score": 105.0}, {"Vertex_ID": "E", "score": 33.0}, {"Vertex_ID": "F", "score": 20.0}, {"Vertex_ID": "G", "score": 84.0}, {"Vertex_ID": "H", "score": 109.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/Hub_Spoke_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/Hub_Spoke_Weighted.json new file mode 100644 index 00000000..f6e52713 --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/Hub_Spoke_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 190.0}, {"Vertex_ID": "B", "score": 10.0}, {"Vertex_ID": "C", "score": 2.0}, {"Vertex_ID": "D", "score": 5.0}, {"Vertex_ID": "E", "score": -3.0}, {"Vertex_ID": "F", "score": -10.0}, {"Vertex_ID": "G", "score": 8.0}, {"Vertex_ID": "H", "score": 25.0}, {"Vertex_ID": "I", "score": 31.0}, {"Vertex_ID": "J", "score": 4.0}, {"Vertex_ID": "K", "score": -8.0}, {"Vertex_ID": "L", "score": 6.0}, {"Vertex_ID": "M", "score": 44.0}, {"Vertex_ID": "N", "score": 17.0}, {"Vertex_ID": "O", "score": 0.0}, {"Vertex_ID": "P", "score": 24.0}, {"Vertex_ID": "Q", "score": -7.0}, {"Vertex_ID": "R", "score": -9.0}, {"Vertex_ID": "S", "score": 16.0}, {"Vertex_ID": "T", "score": 35.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/Line_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/Line_Weighted.json new file mode 100644 index 00000000..627ee40d --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/Line_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 5.0}, {"Vertex_ID": "B", "score": 4.0}, {"Vertex_ID": "C", "score": 6.0}, {"Vertex_ID": "D", "score": 35.0}, {"Vertex_ID": "E", "score": 71.0}, {"Vertex_ID": "F", "score": 47.0}, {"Vertex_ID": "G", "score": -6.0}, {"Vertex_ID": "H", "score": -2.0}, {"Vertex_ID": "I", "score": 30.0}, {"Vertex_ID": "J", "score": 74.0}, {"Vertex_ID": "K", "score": 52.0}, {"Vertex_ID": "L", "score": -12.0}, {"Vertex_ID": "M", "score": 5.0}, {"Vertex_ID": "N", "score": 48.0}, {"Vertex_ID": "O", "score": 33.0}, {"Vertex_ID": "P", "score": 3.0}, {"Vertex_ID": "Q", "score": 26.0}, {"Vertex_ID": "R", "score": 17.0}, {"Vertex_ID": "S", "score": 7.0}, {"Vertex_ID": "T", "score": 15.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/Ring_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/Ring_Weighted.json new file mode 100644 index 00000000..32c2e50c --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/Ring_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 21.0}, {"Vertex_ID": "B", "score": 3.0}, {"Vertex_ID": "T", "score": 18.0}, {"Vertex_ID": "C", "score": -1.0}, {"Vertex_ID": "D", "score": 6.0}, {"Vertex_ID": "E", "score": 18.0}, {"Vertex_ID": "F", "score": 6.0}, {"Vertex_ID": "G", "score": 11.0}, {"Vertex_ID": "H", "score": 18.0}, {"Vertex_ID": "I", "score": 21.0}, {"Vertex_ID": "J", "score": 15.0}, {"Vertex_ID": "K", "score": -7.0}, {"Vertex_ID": "L", "score": 2.0}, {"Vertex_ID": "M", "score": 18.0}, {"Vertex_ID": "N", "score": 17.0}, {"Vertex_ID": "O", "score": 14.0}, {"Vertex_ID": "P", "score": 20.0}, {"Vertex_ID": "Q", "score": 11.0}, {"Vertex_ID": "R", "score": 14.0}, {"Vertex_ID": "S", "score": 13.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/Tree_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/Tree_Weighted.json new file mode 100644 index 00000000..39475474 --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/Tree_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 3.0}, {"Vertex_ID": "B", "score": 8.0}, {"Vertex_ID": "C", "score": 73.0}, {"Vertex_ID": "D", "score": 29.0}, {"Vertex_ID": "E", "score": 29.0}, {"Vertex_ID": "F", "score": 17.0}, {"Vertex_ID": "G", "score": 83.0}, {"Vertex_ID": "H", "score": 5.0}, {"Vertex_ID": "I", "score": 59.0}, {"Vertex_ID": "J", "score": 24.0}, {"Vertex_ID": "K", "score": 4.0}, {"Vertex_ID": "L", "score": -10.0}, {"Vertex_ID": "M", "score": 5.0}, {"Vertex_ID": "N", "score": 12.0}, {"Vertex_ID": "O", "score": 21.0}, {"Vertex_ID": "P", "score": 11.0}, {"Vertex_ID": "Q", "score": -6.0}, {"Vertex_ID": "R", "score": -5.0}, {"Vertex_ID": "S", "score": 33.0}, {"Vertex_ID": "T", "score": 7.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Complete_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Complete_Directed_Weighted.json new file mode 100644 index 00000000..9a6907cc --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Complete_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 79.0}, {"Vertex_ID": "B", "score": 75.0}, {"Vertex_ID": "C", "score": 116.0}, {"Vertex_ID": "D", "score": 80.0}, {"Vertex_ID": "E", "score": 81.0}, {"Vertex_ID": "F", "score": 17.0}, {"Vertex_ID": "G", "score": 96.0}, {"Vertex_ID": "H", "score": 90.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Hub_Spoke_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Hub_Spoke_Directed_Weighted.json new file mode 100644 index 00000000..f70fa0bb --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Hub_Spoke_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "B", "score": 10.0}, {"Vertex_ID": "C", "score": 2.0}, {"Vertex_ID": "D", "score": 5.0}, {"Vertex_ID": "E", "score": -3.0}, {"Vertex_ID": "F", "score": -10.0}, {"Vertex_ID": "G", "score": 8.0}, {"Vertex_ID": "H", "score": 25.0}, {"Vertex_ID": "I", "score": 31.0}, {"Vertex_ID": "J", "score": 4.0}, {"Vertex_ID": "K", "score": -8.0}, {"Vertex_ID": "L", "score": 6.0}, {"Vertex_ID": "M", "score": 44.0}, {"Vertex_ID": "N", "score": 17.0}, {"Vertex_ID": "O", "score": 0.0}, {"Vertex_ID": "P", "score": 24.0}, {"Vertex_ID": "Q", "score": -7.0}, {"Vertex_ID": "R", "score": -9.0}, {"Vertex_ID": "S", "score": 16.0}, {"Vertex_ID": "T", "score": 35.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Line_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Line_Directed_Weighted.json new file mode 100644 index 00000000..923197e9 --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Line_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "B", "score": 5.0}, {"Vertex_ID": "C", "score": -1.0}, {"Vertex_ID": "D", "score": 7.0}, {"Vertex_ID": "E", "score": 28.0}, {"Vertex_ID": "F", "score": 43.0}, {"Vertex_ID": "G", "score": 4.0}, {"Vertex_ID": "H", "score": -10.0}, {"Vertex_ID": "I", "score": 8.0}, {"Vertex_ID": "J", "score": 22.0}, {"Vertex_ID": "K", "score": 52.0}, {"Vertex_ID": "L", "score": 0.0}, {"Vertex_ID": "M", "score": -12.0}, {"Vertex_ID": "N", "score": 17.0}, {"Vertex_ID": "O", "score": 31.0}, {"Vertex_ID": "P", "score": 2.0}, {"Vertex_ID": "Q", "score": 1.0}, {"Vertex_ID": "R", "score": 25.0}, {"Vertex_ID": "S", "score": -8.0}, {"Vertex_ID": "T", "score": 15.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Ring_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Ring_Directed_Weighted.json new file mode 100644 index 00000000..83098f49 --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Ring_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "B", "score": 2.0}, {"Vertex_ID": "C", "score": 1.0}, {"Vertex_ID": "D", "score": -2.0}, {"Vertex_ID": "E", "score": 8.0}, {"Vertex_ID": "F", "score": 10.0}, {"Vertex_ID": "G", "score": -4.0}, {"Vertex_ID": "H", "score": 15.0}, {"Vertex_ID": "I", "score": 3.0}, {"Vertex_ID": "J", "score": 18.0}, {"Vertex_ID": "K", "score": -3.0}, {"Vertex_ID": "L", "score": -4.0}, {"Vertex_ID": "M", "score": 6.0}, {"Vertex_ID": "N", "score": 12.0}, {"Vertex_ID": "O", "score": 5.0}, {"Vertex_ID": "P", "score": 9.0}, {"Vertex_ID": "Q", "score": 11.0}, {"Vertex_ID": "R", "score": 0.0}, {"Vertex_ID": "S", "score": 14.0}, {"Vertex_ID": "T", "score": -1.0}, {"Vertex_ID": "A", "score": 19.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Tree_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Tree_Directed_Weighted.json new file mode 100644 index 00000000..abb2e1f9 --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/in_degree/Tree_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "B", "score": 2.0}, {"Vertex_ID": "C", "score": 1.0}, {"Vertex_ID": "D", "score": -2.0}, {"Vertex_ID": "E", "score": 8.0}, {"Vertex_ID": "F", "score": 22.0}, {"Vertex_ID": "G", "score": 50.0}, {"Vertex_ID": "H", "score": 0.0}, {"Vertex_ID": "I", "score": 31.0}, {"Vertex_ID": "J", "score": 17.0}, {"Vertex_ID": "K", "score": 4.0}, {"Vertex_ID": "L", "score": -10.0}, {"Vertex_ID": "M", "score": 5.0}, {"Vertex_ID": "N", "score": 12.0}, {"Vertex_ID": "O", "score": 21.0}, {"Vertex_ID": "P", "score": 11.0}, {"Vertex_ID": "Q", "score": -6.0}, {"Vertex_ID": "R", "score": -5.0}, {"Vertex_ID": "S", "score": 33.0}, {"Vertex_ID": "T", "score": 7.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Complete_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Complete_Directed_Weighted.json new file mode 100644 index 00000000..e5c2b1de --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Complete_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 68.0}, {"Vertex_ID": "B", "score": 51.0}, {"Vertex_ID": "C", "score": 61.0}, {"Vertex_ID": "D", "score": 168.0}, {"Vertex_ID": "E", "score": 67.0}, {"Vertex_ID": "F", "score": 80.0}, {"Vertex_ID": "G", "score": 114.0}, {"Vertex_ID": "H", "score": 25.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Hub_Spoke_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Hub_Spoke_Directed_Weighted.json new file mode 100644 index 00000000..4b28c2fc --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Hub_Spoke_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 190.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Line_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Line_Directed_Weighted.json new file mode 100644 index 00000000..102dd49c --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Line_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 5.0}, {"Vertex_ID": "B", "score": -1.0}, {"Vertex_ID": "C", "score": 7.0}, {"Vertex_ID": "D", "score": 28.0}, {"Vertex_ID": "E", "score": 43.0}, {"Vertex_ID": "F", "score": 4.0}, {"Vertex_ID": "G", "score": -10.0}, {"Vertex_ID": "H", "score": 8.0}, {"Vertex_ID": "I", "score": 22.0}, {"Vertex_ID": "J", "score": 52.0}, {"Vertex_ID": "K", "score": 0.0}, {"Vertex_ID": "L", "score": -12.0}, {"Vertex_ID": "M", "score": 17.0}, {"Vertex_ID": "N", "score": 31.0}, {"Vertex_ID": "O", "score": 2.0}, {"Vertex_ID": "P", "score": 1.0}, {"Vertex_ID": "Q", "score": 25.0}, {"Vertex_ID": "R", "score": -8.0}, {"Vertex_ID": "S", "score": 15.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Ring_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Ring_Directed_Weighted.json new file mode 100644 index 00000000..4609b3bf --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Ring_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 2.0}, {"Vertex_ID": "B", "score": 1.0}, {"Vertex_ID": "C", "score": -2.0}, {"Vertex_ID": "D", "score": 8.0}, {"Vertex_ID": "E", "score": 10.0}, {"Vertex_ID": "F", "score": -4.0}, {"Vertex_ID": "G", "score": 15.0}, {"Vertex_ID": "H", "score": 3.0}, {"Vertex_ID": "I", "score": 18.0}, {"Vertex_ID": "J", "score": -3.0}, {"Vertex_ID": "K", "score": -4.0}, {"Vertex_ID": "L", "score": 6.0}, {"Vertex_ID": "M", "score": 12.0}, {"Vertex_ID": "N", "score": 5.0}, {"Vertex_ID": "O", "score": 9.0}, {"Vertex_ID": "P", "score": 11.0}, {"Vertex_ID": "Q", "score": 0.0}, {"Vertex_ID": "R", "score": 14.0}, {"Vertex_ID": "S", "score": -1.0}, {"Vertex_ID": "T", "score": 19.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Tree_Directed_Weighted.json b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Tree_Directed_Weighted.json new file mode 100644 index 00000000..051b899a --- /dev/null +++ b/tests/data/baseline/centrality/weighted_degree_centrality/out_degree/Tree_Directed_Weighted.json @@ -0,0 +1 @@ +[{"top_scores": [{"Vertex_ID": "A", "score": 3.0}, {"Vertex_ID": "B", "score": 6.0}, {"Vertex_ID": "C", "score": 72.0}, {"Vertex_ID": "D", "score": 31.0}, {"Vertex_ID": "E", "score": 21.0}, {"Vertex_ID": "F", "score": -5.0}, {"Vertex_ID": "G", "score": 33.0}, {"Vertex_ID": "H", "score": 5.0}, {"Vertex_ID": "I", "score": 28.0}, {"Vertex_ID": "J", "score": 7.0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Complete.json b/tests/data/baseline/community/lcc/Complete.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Complete.json rename to tests/data/baseline/community/lcc/Complete.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Complete_Directed.json b/tests/data/baseline/community/lcc/Complete_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Complete_Directed.json rename to tests/data/baseline/community/lcc/Complete_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/DAG_Directed.json b/tests/data/baseline/community/lcc/DAG_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/DAG_Directed.json rename to tests/data/baseline/community/lcc/DAG_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Empty.json b/tests/data/baseline/community/lcc/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Empty.json rename to tests/data/baseline/community/lcc/Empty.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Empty_Directed.json b/tests/data/baseline/community/lcc/Empty_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Empty_Directed.json rename to tests/data/baseline/community/lcc/Empty_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Hub_Connected_Hub_Spoke.json b/tests/data/baseline/community/lcc/Hub_Connected_Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Hub_Connected_Hub_Spoke.json rename to tests/data/baseline/community/lcc/Hub_Connected_Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Hub_Spoke.json b/tests/data/baseline/community/lcc/Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Hub_Spoke.json rename to tests/data/baseline/community/lcc/Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Hub_Spoke_Directed.json b/tests/data/baseline/community/lcc/Hub_Spoke_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Hub_Spoke_Directed.json rename to tests/data/baseline/community/lcc/Hub_Spoke_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Line.json b/tests/data/baseline/community/lcc/Line.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Line.json rename to tests/data/baseline/community/lcc/Line.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Line_Directed.json b/tests/data/baseline/community/lcc/Line_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Line_Directed.json rename to tests/data/baseline/community/lcc/Line_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Line_Weighted.json b/tests/data/baseline/community/lcc/Line_Weighted.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Line_Weighted.json rename to tests/data/baseline/community/lcc/Line_Weighted.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Ring.json b/tests/data/baseline/community/lcc/Ring.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Ring.json rename to tests/data/baseline/community/lcc/Ring.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Ring_Directed.json b/tests/data/baseline/community/lcc/Ring_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Ring_Directed.json rename to tests/data/baseline/community/lcc/Ring_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Tree.json b/tests/data/baseline/community/lcc/Tree.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Tree.json rename to tests/data/baseline/community/lcc/Tree.json diff --git a/tests/data/baseline/graph_algorithms_baselines/community/lcc/Tree_Directed.json b/tests/data/baseline/community/lcc/Tree_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/community/lcc/Tree_Directed.json rename to tests/data/baseline/community/lcc/Tree_Directed.json diff --git a/tests/data/baseline/get_data.py b/tests/data/baseline/get_data.py index 88e91682..aa0fe666 100644 --- a/tests/data/baseline/get_data.py +++ b/tests/data/baseline/get_data.py @@ -66,3 +66,5 @@ def download_dir(prefix, local, bucket, client=s3_client): local=".", bucket="tigergraph-public-data", ) + + # os.system("mv graph_algorithms_baselines/* .") diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Hub_Spoke.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Hub_Spoke.json deleted file mode 100644 index 6e10710d..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Hub_Spoke.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "A", "score": 19}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "T", "score": 1}, {"Vertex_ID": "H", "score": 1}, {"Vertex_ID": "G", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "F", "score": 1}, {"Vertex_ID": "D", "score": 1}, {"Vertex_ID": "E", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "I", "score": 1}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "Q", "score": 1}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Line.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Line.json deleted file mode 100644 index f52803e2..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Line.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "P", "score": 2}, {"Vertex_ID": "N", "score": 2}, {"Vertex_ID": "C", "score": 2}, {"Vertex_ID": "H", "score": 2}, {"Vertex_ID": "B", "score": 2}, {"Vertex_ID": "M", "score": 2}, {"Vertex_ID": "O", "score": 2}, {"Vertex_ID": "R", "score": 2}, {"Vertex_ID": "K", "score": 2}, {"Vertex_ID": "L", "score": 2}, {"Vertex_ID": "J", "score": 2}, {"Vertex_ID": "Q", "score": 2}, {"Vertex_ID": "D", "score": 2}, {"Vertex_ID": "E", "score": 2}, {"Vertex_ID": "G", "score": 2}, {"Vertex_ID": "F", "score": 2}, {"Vertex_ID": "I", "score": 2}, {"Vertex_ID": "S", "score": 2}, {"Vertex_ID": "A", "score": 1}, {"Vertex_ID": "T", "score": 1}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Ring.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Ring.json deleted file mode 100644 index 6334382b..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Ring.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "M", "score": 2}, {"Vertex_ID": "Q", "score": 2}, {"Vertex_ID": "N", "score": 2}, {"Vertex_ID": "O", "score": 2}, {"Vertex_ID": "K", "score": 2}, {"Vertex_ID": "C", "score": 2}, {"Vertex_ID": "B", "score": 2}, {"Vertex_ID": "D", "score": 2}, {"Vertex_ID": "E", "score": 2}, {"Vertex_ID": "T", "score": 2}, {"Vertex_ID": "R", "score": 2}, {"Vertex_ID": "F", "score": 2}, {"Vertex_ID": "A", "score": 2}, {"Vertex_ID": "H", "score": 2}, {"Vertex_ID": "G", "score": 2}, {"Vertex_ID": "I", "score": 2}, {"Vertex_ID": "J", "score": 2}, {"Vertex_ID": "S", "score": 2}, {"Vertex_ID": "L", "score": 2}, {"Vertex_ID": "P", "score": 2}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Tree.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Tree.json deleted file mode 100644 index 85d616d3..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/Tree.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "E", "score": 3}, {"Vertex_ID": "H", "score": 3}, {"Vertex_ID": "B", "score": 3}, {"Vertex_ID": "G", "score": 3}, {"Vertex_ID": "D", "score": 3}, {"Vertex_ID": "F", "score": 3}, {"Vertex_ID": "I", "score": 3}, {"Vertex_ID": "C", "score": 3}, {"Vertex_ID": "J", "score": 2}, {"Vertex_ID": "A", "score": 2}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "T", "score": 1}, {"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "P", "score": 1}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Hub_Spoke_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Hub_Spoke_Directed.json deleted file mode 100644 index 0527ce44..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Hub_Spoke_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "I", "score": 1}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "D", "score": 1}, {"Vertex_ID": "E", "score": 1}, {"Vertex_ID": "F", "score": 1}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "G", "score": 1}, {"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "H", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "T", "score": 1}, {"Vertex_ID": "A", "score": 0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Line_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Line_Directed.json deleted file mode 100644 index cb2bda6d..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Line_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "H", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "G", "score": 1}, {"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "T", "score": 1}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "D", "score": 1}, {"Vertex_ID": "E", "score": 1}, {"Vertex_ID": "F", "score": 1}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "I", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "A", "score": 0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Ring_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Ring_Directed.json deleted file mode 100644 index 18f77d14..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Ring_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "E", "score": 1}, {"Vertex_ID": "T", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "I", "score": 1}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "H", "score": 1}, {"Vertex_ID": "G", "score": 1}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "A", "score": 1}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "D", "score": 1}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "F", "score": 1}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Tree_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Tree_Directed.json deleted file mode 100644 index a00f147c..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/Tree_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "G", "score": 1}, {"Vertex_ID": "T", "score": 1}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "F", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "I", "score": 1}, {"Vertex_ID": "E", "score": 1}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "D", "score": 1}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "H", "score": 1}, {"Vertex_ID": "A", "score": 0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Hub_Spoke_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Hub_Spoke_Directed.json deleted file mode 100644 index 5bb19d3a..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Hub_Spoke_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "A", "score": 19}, {"Vertex_ID": "D", "score": 0}, {"Vertex_ID": "K", "score": 0}, {"Vertex_ID": "M", "score": 0}, {"Vertex_ID": "I", "score": 0}, {"Vertex_ID": "F", "score": 0}, {"Vertex_ID": "J", "score": 0}, {"Vertex_ID": "B", "score": 0}, {"Vertex_ID": "R", "score": 0}, {"Vertex_ID": "E", "score": 0}, {"Vertex_ID": "P", "score": 0}, {"Vertex_ID": "Q", "score": 0}, {"Vertex_ID": "H", "score": 0}, {"Vertex_ID": "G", "score": 0}, {"Vertex_ID": "O", "score": 0}, {"Vertex_ID": "C", "score": 0}, {"Vertex_ID": "L", "score": 0}, {"Vertex_ID": "T", "score": 0}, {"Vertex_ID": "N", "score": 0}, {"Vertex_ID": "S", "score": 0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Line_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Line_Directed.json deleted file mode 100644 index f939bbc8..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Line_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "A", "score": 1}, {"Vertex_ID": "F", "score": 1}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "H", "score": 1}, {"Vertex_ID": "G", "score": 1}, {"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "D", "score": 1}, {"Vertex_ID": "E", "score": 1}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "I", "score": 1}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "T", "score": 0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Ring_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Ring_Directed.json deleted file mode 100644 index b3ae288a..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Ring_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "I", "score": 1}, {"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "L", "score": 1}, {"Vertex_ID": "R", "score": 1}, {"Vertex_ID": "A", "score": 1}, {"Vertex_ID": "H", "score": 1}, {"Vertex_ID": "G", "score": 1}, {"Vertex_ID": "D", "score": 1}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "E", "score": 1}, {"Vertex_ID": "M", "score": 1}, {"Vertex_ID": "N", "score": 1}, {"Vertex_ID": "K", "score": 1}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "F", "score": 1}, {"Vertex_ID": "S", "score": 1}, {"Vertex_ID": "O", "score": 1}, {"Vertex_ID": "T", "score": 1}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Tree_Directed.json b/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Tree_Directed.json deleted file mode 100644 index d3515537..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/Tree_Directed.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "I", "score": 2}, {"Vertex_ID": "F", "score": 2}, {"Vertex_ID": "A", "score": 2}, {"Vertex_ID": "D", "score": 2}, {"Vertex_ID": "G", "score": 2}, {"Vertex_ID": "B", "score": 2}, {"Vertex_ID": "C", "score": 2}, {"Vertex_ID": "H", "score": 2}, {"Vertex_ID": "E", "score": 2}, {"Vertex_ID": "J", "score": 1}, {"Vertex_ID": "P", "score": 0}, {"Vertex_ID": "Q", "score": 0}, {"Vertex_ID": "O", "score": 0}, {"Vertex_ID": "S", "score": 0}, {"Vertex_ID": "L", "score": 0}, {"Vertex_ID": "N", "score": 0}, {"Vertex_ID": "T", "score": 0}, {"Vertex_ID": "R", "score": 0}, {"Vertex_ID": "K", "score": 0}, {"Vertex_ID": "M", "score": 0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Hub_Spoke_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Hub_Spoke_Weighted.json deleted file mode 100644 index 12a7f190..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Hub_Spoke_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "A", "score": 190}, {"Vertex_ID": "M", "score": 44}, {"Vertex_ID": "T", "score": 35}, {"Vertex_ID": "I", "score": 31}, {"Vertex_ID": "H", "score": 25}, {"Vertex_ID": "P", "score": 24}, {"Vertex_ID": "N", "score": 17}, {"Vertex_ID": "S", "score": 16}, {"Vertex_ID": "B", "score": 10}, {"Vertex_ID": "G", "score": 8}, {"Vertex_ID": "L", "score": 6}, {"Vertex_ID": "D", "score": 5}, {"Vertex_ID": "J", "score": 4}, {"Vertex_ID": "C", "score": 2}, {"Vertex_ID": "O", "score": 0}, {"Vertex_ID": "E", "score": -3}, {"Vertex_ID": "Q", "score": -7}, {"Vertex_ID": "K", "score": -8}, {"Vertex_ID": "R", "score": -9}, {"Vertex_ID": "F", "score": -10}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Line_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Line_Weighted.json deleted file mode 100644 index 7a185704..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Line_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "J", "score": 74}, {"Vertex_ID": "E", "score": 71}, {"Vertex_ID": "K", "score": 52}, {"Vertex_ID": "N", "score": 48}, {"Vertex_ID": "F", "score": 47}, {"Vertex_ID": "D", "score": 35}, {"Vertex_ID": "O", "score": 33}, {"Vertex_ID": "I", "score": 30}, {"Vertex_ID": "Q", "score": 26}, {"Vertex_ID": "R", "score": 17}, {"Vertex_ID": "T", "score": 15}, {"Vertex_ID": "S", "score": 7}, {"Vertex_ID": "C", "score": 6}, {"Vertex_ID": "A", "score": 5}, {"Vertex_ID": "M", "score": 5}, {"Vertex_ID": "B", "score": 4}, {"Vertex_ID": "P", "score": 3}, {"Vertex_ID": "H", "score": -2}, {"Vertex_ID": "G", "score": -6}, {"Vertex_ID": "L", "score": -12}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Ring_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Ring_Weighted.json deleted file mode 100644 index de4a4934..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Ring_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "I", "score": 21}, {"Vertex_ID": "A", "score": 21}, {"Vertex_ID": "P", "score": 20}, {"Vertex_ID": "E", "score": 18}, {"Vertex_ID": "H", "score": 18}, {"Vertex_ID": "M", "score": 18}, {"Vertex_ID": "T", "score": 18}, {"Vertex_ID": "N", "score": 17}, {"Vertex_ID": "J", "score": 15}, {"Vertex_ID": "O", "score": 14}, {"Vertex_ID": "R", "score": 14}, {"Vertex_ID": "S", "score": 13}, {"Vertex_ID": "Q", "score": 11}, {"Vertex_ID": "G", "score": 11}, {"Vertex_ID": "F", "score": 6}, {"Vertex_ID": "D", "score": 6}, {"Vertex_ID": "B", "score": 3}, {"Vertex_ID": "L", "score": 2}, {"Vertex_ID": "C", "score": -1}, {"Vertex_ID": "K", "score": -7}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Tree_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Tree_Weighted.json deleted file mode 100644 index 048f85f0..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/Tree_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "G", "score": 83}, {"Vertex_ID": "C", "score": 73}, {"Vertex_ID": "I", "score": 59}, {"Vertex_ID": "S", "score": 33}, {"Vertex_ID": "E", "score": 29}, {"Vertex_ID": "D", "score": 29}, {"Vertex_ID": "J", "score": 24}, {"Vertex_ID": "O", "score": 21}, {"Vertex_ID": "F", "score": 17}, {"Vertex_ID": "N", "score": 12}, {"Vertex_ID": "P", "score": 11}, {"Vertex_ID": "B", "score": 8}, {"Vertex_ID": "T", "score": 7}, {"Vertex_ID": "M", "score": 5}, {"Vertex_ID": "H", "score": 5}, {"Vertex_ID": "K", "score": 4}, {"Vertex_ID": "A", "score": 3}, {"Vertex_ID": "R", "score": -5}, {"Vertex_ID": "Q", "score": -6}, {"Vertex_ID": "L", "score": -10}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Hub_Spoke_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Hub_Spoke_Directed_Weighted.json deleted file mode 100644 index 07d55f27..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Hub_Spoke_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "M", "score": 44}, {"Vertex_ID": "T", "score": 35}, {"Vertex_ID": "I", "score": 31}, {"Vertex_ID": "H", "score": 25}, {"Vertex_ID": "P", "score": 24}, {"Vertex_ID": "N", "score": 17}, {"Vertex_ID": "S", "score": 16}, {"Vertex_ID": "B", "score": 10}, {"Vertex_ID": "G", "score": 8}, {"Vertex_ID": "L", "score": 6}, {"Vertex_ID": "D", "score": 5}, {"Vertex_ID": "J", "score": 4}, {"Vertex_ID": "C", "score": 2}, {"Vertex_ID": "O", "score": 0}, {"Vertex_ID": "A", "score": 0}, {"Vertex_ID": "E", "score": -3}, {"Vertex_ID": "Q", "score": -7}, {"Vertex_ID": "K", "score": -8}, {"Vertex_ID": "R", "score": -9}, {"Vertex_ID": "F", "score": -10}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Line_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Line_Directed_Weighted.json deleted file mode 100644 index 76ae95f2..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Line_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "K", "score": 52}, {"Vertex_ID": "F", "score": 43}, {"Vertex_ID": "O", "score": 31}, {"Vertex_ID": "E", "score": 28}, {"Vertex_ID": "R", "score": 25}, {"Vertex_ID": "J", "score": 22}, {"Vertex_ID": "N", "score": 17}, {"Vertex_ID": "T", "score": 15}, {"Vertex_ID": "I", "score": 8}, {"Vertex_ID": "D", "score": 7}, {"Vertex_ID": "B", "score": 5}, {"Vertex_ID": "G", "score": 4}, {"Vertex_ID": "P", "score": 2}, {"Vertex_ID": "Q", "score": 1}, {"Vertex_ID": "A", "score": 0}, {"Vertex_ID": "L", "score": 0}, {"Vertex_ID": "C", "score": -1}, {"Vertex_ID": "S", "score": -8}, {"Vertex_ID": "H", "score": -10}, {"Vertex_ID": "M", "score": -12}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Ring_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Ring_Directed_Weighted.json deleted file mode 100644 index 7c769c9f..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Ring_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "A", "score": 19}, {"Vertex_ID": "J", "score": 18}, {"Vertex_ID": "H", "score": 15}, {"Vertex_ID": "S", "score": 14}, {"Vertex_ID": "N", "score": 12}, {"Vertex_ID": "Q", "score": 11}, {"Vertex_ID": "F", "score": 10}, {"Vertex_ID": "P", "score": 9}, {"Vertex_ID": "E", "score": 8}, {"Vertex_ID": "M", "score": 6}, {"Vertex_ID": "O", "score": 5}, {"Vertex_ID": "I", "score": 3}, {"Vertex_ID": "B", "score": 2}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "R", "score": 0}, {"Vertex_ID": "T", "score": -1}, {"Vertex_ID": "D", "score": -2}, {"Vertex_ID": "K", "score": -3}, {"Vertex_ID": "G", "score": -4}, {"Vertex_ID": "L", "score": -4}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Tree_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Tree_Directed_Weighted.json deleted file mode 100644 index 090c8105..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/Tree_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "G", "score": 50}, {"Vertex_ID": "S", "score": 33}, {"Vertex_ID": "I", "score": 31}, {"Vertex_ID": "F", "score": 22}, {"Vertex_ID": "O", "score": 21}, {"Vertex_ID": "J", "score": 17}, {"Vertex_ID": "N", "score": 12}, {"Vertex_ID": "P", "score": 11}, {"Vertex_ID": "E", "score": 8}, {"Vertex_ID": "T", "score": 7}, {"Vertex_ID": "M", "score": 5}, {"Vertex_ID": "K", "score": 4}, {"Vertex_ID": "B", "score": 2}, {"Vertex_ID": "C", "score": 1}, {"Vertex_ID": "A", "score": 0}, {"Vertex_ID": "H", "score": 0}, {"Vertex_ID": "D", "score": -2}, {"Vertex_ID": "R", "score": -5}, {"Vertex_ID": "Q", "score": -6}, {"Vertex_ID": "L", "score": -10}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Hub_Spoke_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Hub_Spoke_Directed_Weighted.json deleted file mode 100644 index 66c5eccd..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Hub_Spoke_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "A", "score": 190}, {"Vertex_ID": "B", "score": 0}, {"Vertex_ID": "I", "score": 0}, {"Vertex_ID": "N", "score": 0}, {"Vertex_ID": "Q", "score": 0}, {"Vertex_ID": "L", "score": 0}, {"Vertex_ID": "T", "score": 0}, {"Vertex_ID": "F", "score": 0}, {"Vertex_ID": "O", "score": 0}, {"Vertex_ID": "J", "score": 0}, {"Vertex_ID": "P", "score": 0}, {"Vertex_ID": "C", "score": 0}, {"Vertex_ID": "D", "score": 0}, {"Vertex_ID": "E", "score": 0}, {"Vertex_ID": "H", "score": 0}, {"Vertex_ID": "G", "score": 0}, {"Vertex_ID": "R", "score": 0}, {"Vertex_ID": "S", "score": 0}, {"Vertex_ID": "K", "score": 0}, {"Vertex_ID": "M", "score": 0}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Line_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Line_Directed_Weighted.json deleted file mode 100644 index 1843cdef..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Line_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "J", "score": 52}, {"Vertex_ID": "E", "score": 43}, {"Vertex_ID": "N", "score": 31}, {"Vertex_ID": "D", "score": 28}, {"Vertex_ID": "Q", "score": 25}, {"Vertex_ID": "I", "score": 22}, {"Vertex_ID": "M", "score": 17}, {"Vertex_ID": "S", "score": 15}, {"Vertex_ID": "H", "score": 8}, {"Vertex_ID": "C", "score": 7}, {"Vertex_ID": "A", "score": 5}, {"Vertex_ID": "F", "score": 4}, {"Vertex_ID": "O", "score": 2}, {"Vertex_ID": "P", "score": 1}, {"Vertex_ID": "K", "score": 0}, {"Vertex_ID": "T", "score": 0}, {"Vertex_ID": "B", "score": -1}, {"Vertex_ID": "R", "score": -8}, {"Vertex_ID": "G", "score": -10}, {"Vertex_ID": "L", "score": -12}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Ring_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Ring_Directed_Weighted.json deleted file mode 100644 index cfead7a4..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Ring_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "T", "score": 19}, {"Vertex_ID": "I", "score": 18}, {"Vertex_ID": "G", "score": 15}, {"Vertex_ID": "R", "score": 14}, {"Vertex_ID": "M", "score": 12}, {"Vertex_ID": "P", "score": 11}, {"Vertex_ID": "E", "score": 10}, {"Vertex_ID": "O", "score": 9}, {"Vertex_ID": "D", "score": 8}, {"Vertex_ID": "L", "score": 6}, {"Vertex_ID": "N", "score": 5}, {"Vertex_ID": "H", "score": 3}, {"Vertex_ID": "A", "score": 2}, {"Vertex_ID": "B", "score": 1}, {"Vertex_ID": "Q", "score": 0}, {"Vertex_ID": "S", "score": -1}, {"Vertex_ID": "C", "score": -2}, {"Vertex_ID": "J", "score": -3}, {"Vertex_ID": "K", "score": -4}, {"Vertex_ID": "F", "score": -4}]}] \ No newline at end of file diff --git a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Tree_Directed_Weighted.json b/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Tree_Directed_Weighted.json deleted file mode 100644 index 7d13d741..00000000 --- a/tests/data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/Tree_Directed_Weighted.json +++ /dev/null @@ -1 +0,0 @@ -[{"top_scores": [{"Vertex_ID": "C", "score": 72}, {"Vertex_ID": "G", "score": 33}, {"Vertex_ID": "D", "score": 31}, {"Vertex_ID": "I", "score": 28}, {"Vertex_ID": "E", "score": 21}, {"Vertex_ID": "J", "score": 7}, {"Vertex_ID": "B", "score": 6}, {"Vertex_ID": "H", "score": 5}, {"Vertex_ID": "A", "score": 3}, {"Vertex_ID": "Q", "score": 0}, {"Vertex_ID": "T", "score": 0}, {"Vertex_ID": "N", "score": 0}, {"Vertex_ID": "M", "score": 0}, {"Vertex_ID": "L", "score": 0}, {"Vertex_ID": "O", "score": 0}, {"Vertex_ID": "P", "score": 0}, {"Vertex_ID": "R", "score": 0}, {"Vertex_ID": "S", "score": 0}, {"Vertex_ID": "K", "score": 0}, {"Vertex_ID": "F", "score": -5}]}] \ No newline at end of file diff --git a/tests/data/baseline/ml/fastRP.json.gz b/tests/data/baseline/ml/fastRP.json.gz new file mode 100644 index 00000000..2fa29708 Binary files /dev/null and b/tests/data/baseline/ml/fastRP.json.gz differ diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Complete.json b/tests/data/baseline/path_finding/bfs/Complete.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Complete.json rename to tests/data/baseline/path_finding/bfs/Complete.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Complete_Directed.json b/tests/data/baseline/path_finding/bfs/Complete_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Complete_Directed.json rename to tests/data/baseline/path_finding/bfs/Complete_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/DAG_Directed.json b/tests/data/baseline/path_finding/bfs/DAG_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/DAG_Directed.json rename to tests/data/baseline/path_finding/bfs/DAG_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Empty.json b/tests/data/baseline/path_finding/bfs/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Empty.json rename to tests/data/baseline/path_finding/bfs/Empty.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Empty_Directed.json b/tests/data/baseline/path_finding/bfs/Empty_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Empty_Directed.json rename to tests/data/baseline/path_finding/bfs/Empty_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Hub_Connected_Hub_Spoke.json b/tests/data/baseline/path_finding/bfs/Hub_Connected_Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Hub_Connected_Hub_Spoke.json rename to tests/data/baseline/path_finding/bfs/Hub_Connected_Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Hub_Spoke.json b/tests/data/baseline/path_finding/bfs/Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Hub_Spoke.json rename to tests/data/baseline/path_finding/bfs/Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Hub_Spoke_Directed.json b/tests/data/baseline/path_finding/bfs/Hub_Spoke_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Hub_Spoke_Directed.json rename to tests/data/baseline/path_finding/bfs/Hub_Spoke_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Line.json b/tests/data/baseline/path_finding/bfs/Line.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Line.json rename to tests/data/baseline/path_finding/bfs/Line.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Line_Directed.json b/tests/data/baseline/path_finding/bfs/Line_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Line_Directed.json rename to tests/data/baseline/path_finding/bfs/Line_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Line_Weighted.json b/tests/data/baseline/path_finding/bfs/Line_Weighted.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Line_Weighted.json rename to tests/data/baseline/path_finding/bfs/Line_Weighted.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Ring.json b/tests/data/baseline/path_finding/bfs/Ring.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Ring.json rename to tests/data/baseline/path_finding/bfs/Ring.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Ring_Directed.json b/tests/data/baseline/path_finding/bfs/Ring_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Ring_Directed.json rename to tests/data/baseline/path_finding/bfs/Ring_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Tree.json b/tests/data/baseline/path_finding/bfs/Tree.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Tree.json rename to tests/data/baseline/path_finding/bfs/Tree.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Tree_Directed.json b/tests/data/baseline/path_finding/bfs/Tree_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/bfs/Tree_Directed.json rename to tests/data/baseline/path_finding/bfs/Tree_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Complete.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Complete.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Complete.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Complete.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Complete_Directed.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Complete_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Complete_Directed.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Complete_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/DAG_Directed.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/DAG_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/DAG_Directed.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/DAG_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Empty.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Empty.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Empty.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Empty.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Empty_Directed.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Empty_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Empty_Directed.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Empty_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Hub_Connected_Hub_Spoke.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Hub_Connected_Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Hub_Connected_Hub_Spoke.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Hub_Connected_Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Hub_Spoke.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Hub_Spoke.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Hub_Spoke.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Hub_Spoke.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Hub_Spoke_Directed.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Hub_Spoke_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Hub_Spoke_Directed.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Hub_Spoke_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Line.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Line.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Line.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Line.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Line_Directed.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Line_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Line_Directed.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Line_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Line_Weighted.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Line_Weighted.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Line_Weighted.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Line_Weighted.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Ring.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Ring.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Ring.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Ring.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Ring_Directed.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Ring_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Ring_Directed.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Ring_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Tree.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Tree.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Tree.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Tree.json diff --git a/tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Tree_Directed.json b/tests/data/baseline/path_finding/shortest_ss_no_wt/Tree_Directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/path_finding/shortest_ss_no_wt/Tree_Directed.json rename to tests/data/baseline/path_finding/shortest_ss_no_wt/Tree_Directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link1.json b/tests/data/baseline/topological_link_prediction/adamic_adar/topo_link1.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link1.json rename to tests/data/baseline/topological_link_prediction/adamic_adar/topo_link1.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link2.json b/tests/data/baseline/topological_link_prediction/adamic_adar/topo_link2.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link2.json rename to tests/data/baseline/topological_link_prediction/adamic_adar/topo_link2.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link3.json b/tests/data/baseline/topological_link_prediction/adamic_adar/topo_link3.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link3.json rename to tests/data/baseline/topological_link_prediction/adamic_adar/topo_link3.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link4.json b/tests/data/baseline/topological_link_prediction/adamic_adar/topo_link4.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link4.json rename to tests/data/baseline/topological_link_prediction/adamic_adar/topo_link4.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link5.json b/tests/data/baseline/topological_link_prediction/adamic_adar/topo_link5.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link5.json rename to tests/data/baseline/topological_link_prediction/adamic_adar/topo_link5.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link6.json b/tests/data/baseline/topological_link_prediction/adamic_adar/topo_link6.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link6.json rename to tests/data/baseline/topological_link_prediction/adamic_adar/topo_link6.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link_directed.json b/tests/data/baseline/topological_link_prediction/adamic_adar/topo_link_directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/adamic_adar/topo_link_directed.json rename to tests/data/baseline/topological_link_prediction/adamic_adar/topo_link_directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link1.json b/tests/data/baseline/topological_link_prediction/common_neighbors/topo_link1.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link1.json rename to tests/data/baseline/topological_link_prediction/common_neighbors/topo_link1.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link2.json b/tests/data/baseline/topological_link_prediction/common_neighbors/topo_link2.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link2.json rename to tests/data/baseline/topological_link_prediction/common_neighbors/topo_link2.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link3.json b/tests/data/baseline/topological_link_prediction/common_neighbors/topo_link3.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link3.json rename to tests/data/baseline/topological_link_prediction/common_neighbors/topo_link3.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link4.json b/tests/data/baseline/topological_link_prediction/common_neighbors/topo_link4.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link4.json rename to tests/data/baseline/topological_link_prediction/common_neighbors/topo_link4.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link5.json b/tests/data/baseline/topological_link_prediction/common_neighbors/topo_link5.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link5.json rename to tests/data/baseline/topological_link_prediction/common_neighbors/topo_link5.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link6.json b/tests/data/baseline/topological_link_prediction/common_neighbors/topo_link6.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link6.json rename to tests/data/baseline/topological_link_prediction/common_neighbors/topo_link6.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link_directed.json b/tests/data/baseline/topological_link_prediction/common_neighbors/topo_link_directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/common_neighbors/topo_link_directed.json rename to tests/data/baseline/topological_link_prediction/common_neighbors/topo_link_directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link1.json b/tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link1.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link1.json rename to tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link1.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link2.json b/tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link2.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link2.json rename to tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link2.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link3.json b/tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link3.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link3.json rename to tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link3.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link4.json b/tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link4.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link4.json rename to tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link4.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link5.json b/tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link5.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link5.json rename to tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link5.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link6.json b/tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link6.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link6.json rename to tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link6.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link_directed.json b/tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link_directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/preferential_attachment/topo_link_directed.json rename to tests/data/baseline/topological_link_prediction/preferential_attachment/topo_link_directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link1.json b/tests/data/baseline/topological_link_prediction/resource_allocation/topo_link1.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link1.json rename to tests/data/baseline/topological_link_prediction/resource_allocation/topo_link1.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link2.json b/tests/data/baseline/topological_link_prediction/resource_allocation/topo_link2.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link2.json rename to tests/data/baseline/topological_link_prediction/resource_allocation/topo_link2.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link3.json b/tests/data/baseline/topological_link_prediction/resource_allocation/topo_link3.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link3.json rename to tests/data/baseline/topological_link_prediction/resource_allocation/topo_link3.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link4.json b/tests/data/baseline/topological_link_prediction/resource_allocation/topo_link4.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link4.json rename to tests/data/baseline/topological_link_prediction/resource_allocation/topo_link4.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link5.json b/tests/data/baseline/topological_link_prediction/resource_allocation/topo_link5.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link5.json rename to tests/data/baseline/topological_link_prediction/resource_allocation/topo_link5.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link6.json b/tests/data/baseline/topological_link_prediction/resource_allocation/topo_link6.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link6.json rename to tests/data/baseline/topological_link_prediction/resource_allocation/topo_link6.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link_directed.json b/tests/data/baseline/topological_link_prediction/resource_allocation/topo_link_directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/resource_allocation/topo_link_directed.json rename to tests/data/baseline/topological_link_prediction/resource_allocation/topo_link_directed.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test1.json b/tests/data/baseline/topological_link_prediction/same_community/test1.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test1.json rename to tests/data/baseline/topological_link_prediction/same_community/test1.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test2.json b/tests/data/baseline/topological_link_prediction/same_community/test2.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test2.json rename to tests/data/baseline/topological_link_prediction/same_community/test2.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test3.json b/tests/data/baseline/topological_link_prediction/same_community/test3.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test3.json rename to tests/data/baseline/topological_link_prediction/same_community/test3.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test4.json b/tests/data/baseline/topological_link_prediction/same_community/test4.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/same_community/test4.json rename to tests/data/baseline/topological_link_prediction/same_community/test4.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link1.json b/tests/data/baseline/topological_link_prediction/total_neighbors/topo_link1.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link1.json rename to tests/data/baseline/topological_link_prediction/total_neighbors/topo_link1.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link2.json b/tests/data/baseline/topological_link_prediction/total_neighbors/topo_link2.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link2.json rename to tests/data/baseline/topological_link_prediction/total_neighbors/topo_link2.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link3.json b/tests/data/baseline/topological_link_prediction/total_neighbors/topo_link3.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link3.json rename to tests/data/baseline/topological_link_prediction/total_neighbors/topo_link3.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link4.json b/tests/data/baseline/topological_link_prediction/total_neighbors/topo_link4.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link4.json rename to tests/data/baseline/topological_link_prediction/total_neighbors/topo_link4.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link5.json b/tests/data/baseline/topological_link_prediction/total_neighbors/topo_link5.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link5.json rename to tests/data/baseline/topological_link_prediction/total_neighbors/topo_link5.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link6.json b/tests/data/baseline/topological_link_prediction/total_neighbors/topo_link6.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link6.json rename to tests/data/baseline/topological_link_prediction/total_neighbors/topo_link6.json diff --git a/tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link_directed.json b/tests/data/baseline/topological_link_prediction/total_neighbors/topo_link_directed.json similarity index 100% rename from tests/data/baseline/graph_algorithms_baselines/topological_link_prediction/total_neighbors/topo_link_directed.json rename to tests/data/baseline/topological_link_prediction/total_neighbors/topo_link_directed.json diff --git a/tests/data/unweighted edges/complete_edges.csv b/tests/data/unweighted_edges/complete_edges.csv similarity index 100% rename from tests/data/unweighted edges/complete_edges.csv rename to tests/data/unweighted_edges/complete_edges.csv diff --git a/tests/data/unweighted edges/complete_edges_directed.csv b/tests/data/unweighted_edges/complete_edges_directed.csv similarity index 100% rename from tests/data/unweighted edges/complete_edges_directed.csv rename to tests/data/unweighted_edges/complete_edges_directed.csv diff --git a/tests/data/unweighted edges/dag_edges.csv b/tests/data/unweighted_edges/dag_edges.csv similarity index 100% rename from tests/data/unweighted edges/dag_edges.csv rename to tests/data/unweighted_edges/dag_edges.csv diff --git a/tests/data/unweighted edges/empty_graph_edges.csv b/tests/data/unweighted_edges/empty_graph_edges.csv similarity index 100% rename from tests/data/unweighted edges/empty_graph_edges.csv rename to tests/data/unweighted_edges/empty_graph_edges.csv diff --git a/tests/data/unweighted edges/hubspoke_connected_spoke_edges.csv b/tests/data/unweighted_edges/hubspoke_connected_spoke_edges.csv similarity index 100% rename from tests/data/unweighted edges/hubspoke_connected_spoke_edges.csv rename to tests/data/unweighted_edges/hubspoke_connected_spoke_edges.csv diff --git a/tests/data/unweighted edges/hubspoke_edges.csv b/tests/data/unweighted_edges/hubspoke_edges.csv similarity index 100% rename from tests/data/unweighted edges/hubspoke_edges.csv rename to tests/data/unweighted_edges/hubspoke_edges.csv diff --git a/tests/data/unweighted edges/line_edges.csv b/tests/data/unweighted_edges/line_edges.csv similarity index 100% rename from tests/data/unweighted edges/line_edges.csv rename to tests/data/unweighted_edges/line_edges.csv diff --git a/tests/data/unweighted edges/mulithub_shared_spoke_edges.csv b/tests/data/unweighted_edges/mulithub_shared_spoke_edges.csv similarity index 100% rename from tests/data/unweighted edges/mulithub_shared_spoke_edges.csv rename to tests/data/unweighted_edges/mulithub_shared_spoke_edges.csv diff --git a/tests/data/unweighted edges/ring_edges.csv b/tests/data/unweighted_edges/ring_edges.csv similarity index 100% rename from tests/data/unweighted edges/ring_edges.csv rename to tests/data/unweighted_edges/ring_edges.csv diff --git a/tests/data/unweighted edges/tree_edges.csv b/tests/data/unweighted_edges/tree_edges.csv similarity index 100% rename from tests/data/unweighted edges/tree_edges.csv rename to tests/data/unweighted_edges/tree_edges.csv diff --git a/tests/data/weighted edges/complete_edges.csv b/tests/data/weighted_edges/complete_edges.csv similarity index 100% rename from tests/data/weighted edges/complete_edges.csv rename to tests/data/weighted_edges/complete_edges.csv diff --git a/tests/data/weighted edges/complete_edges_directed.csv b/tests/data/weighted_edges/complete_edges_directed.csv similarity index 100% rename from tests/data/weighted edges/complete_edges_directed.csv rename to tests/data/weighted_edges/complete_edges_directed.csv diff --git a/tests/data/weighted edges/dag_edges.csv b/tests/data/weighted_edges/dag_edges.csv similarity index 100% rename from tests/data/weighted edges/dag_edges.csv rename to tests/data/weighted_edges/dag_edges.csv diff --git a/tests/data/weighted edges/empty_graph_edges.csv b/tests/data/weighted_edges/empty_graph_edges.csv similarity index 100% rename from tests/data/weighted edges/empty_graph_edges.csv rename to tests/data/weighted_edges/empty_graph_edges.csv diff --git a/tests/data/weighted edges/hubspoke_connected_spoke_edges.csv b/tests/data/weighted_edges/hubspoke_connected_spoke_edges.csv similarity index 100% rename from tests/data/weighted edges/hubspoke_connected_spoke_edges.csv rename to tests/data/weighted_edges/hubspoke_connected_spoke_edges.csv diff --git a/tests/data/weighted edges/hubspoke_edges.csv b/tests/data/weighted_edges/hubspoke_edges.csv similarity index 100% rename from tests/data/weighted edges/hubspoke_edges.csv rename to tests/data/weighted_edges/hubspoke_edges.csv diff --git a/tests/data/weighted edges/line_edges.csv b/tests/data/weighted_edges/line_edges.csv similarity index 100% rename from tests/data/weighted edges/line_edges.csv rename to tests/data/weighted_edges/line_edges.csv diff --git a/tests/data/weighted edges/mulithub_shared_spoke_edges.csv b/tests/data/weighted_edges/mulithub_shared_spoke_edges.csv similarity index 100% rename from tests/data/weighted edges/mulithub_shared_spoke_edges.csv rename to tests/data/weighted_edges/mulithub_shared_spoke_edges.csv diff --git a/tests/data/weighted edges/negative_cycles_edges.csv b/tests/data/weighted_edges/negative_cycles_edges.csv similarity index 100% rename from tests/data/weighted edges/negative_cycles_edges.csv rename to tests/data/weighted_edges/negative_cycles_edges.csv diff --git a/tests/data/weighted edges/ring_edges.csv b/tests/data/weighted_edges/ring_edges.csv similarity index 100% rename from tests/data/weighted edges/ring_edges.csv rename to tests/data/weighted_edges/ring_edges.csv diff --git a/tests/data/weighted edges/tree_edges.csv b/tests/data/weighted_edges/tree_edges.csv similarity index 100% rename from tests/data/weighted edges/tree_edges.csv rename to tests/data/weighted_edges/tree_edges.csv diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 00000000..af43a402 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,53 @@ +aiohttp==3.9.5 +aiosignal==1.3.1 +attrs==23.2.0 +boto3==1.28.83 +botocore==1.31.85 +certifi==2024.2.2 +charset-normalizer==3.3.2 +contourpy==1.2.1 +cycler==0.12.1 +execnet==2.1.1 +filelock==3.13.4 +fonttools==4.51.0 +frozenlist==1.4.1 +fsspec==2024.3.1 +idna==3.7 +iniconfig==2.0.0 +Jinja2==3.1.3 +jmespath==1.0.1 +joblib==1.4.0 +kiwisolver==1.4.5 +MarkupSafe==2.1.5 +matplotlib==3.9.0 +mpmath==1.3.0 +multidict==6.0.5 +networkx==3.3 +numpy==1.26.4 +packaging==24.0 +pandas==2.1.1 +pillow==10.3.0 +pluggy==1.5.0 +psutil==5.9.8 +py==1.11.0 +pyparsing==3.1.2 +pytest==8.2.1 +pytest-xdist==3.5.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +pyTigerGraph==1.5.2 +pytz==2024.1 +requests==2.31.0 +s3transfer==0.7.0 +scikit-learn==1.4.2 +scipy==1.13.0 +six==1.16.0 +sympy==1.12 +threadpoolctl==3.4.0 +tomli==2.0.1 +tqdm==4.66.2 +typing_extensions==4.11.0 +tzdata==2024.1 +urllib3==2.0.7 +validators==0.28.1 +yarl==1.9.4 diff --git a/tests/run.sh b/tests/run.sh index df88fcc5..b3a6b214 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -1,4 +1,4 @@ clear -python test/setup.py && - pytest -# pytest --junitxml "output.xml" #-n 4 +python3 test/setup.py && + python3 test/baseline/create_baselines.py && + pytest test/test_centrality.py #test/test_ml.py diff --git a/tests/test/baseline/__init__.py b/tests/test/baseline/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test/baseline/algos/__init__.py b/tests/test/baseline/algos/__init__.py new file mode 100644 index 00000000..328e264d --- /dev/null +++ b/tests/test/baseline/algos/__init__.py @@ -0,0 +1,2 @@ +from .degree_cent import * +from .fastrp import fastrp_wrapper as fastrp diff --git a/tests/test/baseline/algos/degree_cent.py b/tests/test/baseline/algos/degree_cent.py new file mode 100644 index 00000000..4ef80d57 --- /dev/null +++ b/tests/test/baseline/algos/degree_cent.py @@ -0,0 +1,46 @@ +from collections import Counter + +import networkx as nx + + +def run_degree_baseline_complete(g: nx.Graph, _): + s = 1.0 / (len(g) - 1.0) + + # d-1 because nx will double count the self-edge + res = {n: (d - 1) * s for n, d in g.degree()} + + out = [] + for k, v in res.items(): + out.append({"Vertex_ID": k, "score": v}) + + out = [{"top_scores": out}] + return out + + +def run_degree_baseline(g: nx.Graph, metric): + res = metric(g) + + out = [] + for k, v in res.items(): + out.append({"Vertex_ID": k, "score": v}) + + out = [{"top_scores": out}] + return out + + +def weighted_deg_cent( + g: nx.Graph, + dir: str = "", +): + res = Counter() + for e in g.edges: + a = g.get_edge_data(e[0], e[1])["weight"] + match dir: + case "in": + res[e[1]] += a + case "out": + res[e[0]] += a + case _: + res[e[0]] += a + res[e[1]] += a + return res diff --git a/tests/test/baseline/algos/fastrp.py b/tests/test/baseline/algos/fastrp.py new file mode 100644 index 00000000..3200f984 --- /dev/null +++ b/tests/test/baseline/algos/fastrp.py @@ -0,0 +1,107 @@ +# source: https://github.com/GTmac/FastRP/blob/master/fastrp.py + +import numpy as np +from scipy.sparse import csc_matrix, csr_matrix, spdiags +from sklearn import random_projection +from sklearn.preprocessing import normalize, scale + + +# projection method: choose from Gaussian and Sparse +# input matrix: choose from adjacency and transition matrix +# alpha adjusts the weighting of nodes according to their degree +def fastrp_projection( + A, q=3, dim=128, projection_method="gaussian", input_matrix="adj", alpha=None +): + assert input_matrix == "adj" or input_matrix == "trans" + assert projection_method == "gaussian" or projection_method == "sparse" + + if input_matrix == "adj": + M = A + else: + N = A.shape[0] + normalizer = spdiags(np.squeeze(1.0 / csc_matrix.sum(A, axis=1)), 0, N, N) + M = normalizer @ A + # Gaussian projection matrix + if projection_method == "gaussian": + transformer = random_projection.GaussianRandomProjection( + n_components=dim, random_state=42 + ) + # Sparse projection matrix + else: + transformer = random_projection.SparseRandomProjection( + n_components=dim, random_state=42 + ) + Y = transformer.fit(M) + # Random projection for A + if alpha is not None: + Y.components_ = Y.components_ @ spdiags( + np.squeeze(np.power(csc_matrix.sum(A, axis=1), alpha)), 0, N, N + ) + cur_U = transformer.transform(M) + U_list = [cur_U] + + for _ in range(2, q + 1): + cur_U = M @ cur_U + U_list.append(cur_U) + return U_list + + +# When weights is None, concatenate instead of linearly combines the embeddings from different powers of A +def fastrp_merge(U_list, weights, normalization=False): + dense_U_list = ( + [_U.todense() for _U in U_list] if type(U_list[0]) == csc_matrix else U_list + ) + _U_list = ( + [normalize(_U, norm="l2", axis=1) for _U in dense_U_list] + if normalization + else dense_U_list + ) + + if weights is None: + return np.concatenate(_U_list, axis=1) + U = np.zeros_like(_U_list[0]) + for cur_U, weight in zip(_U_list, weights): + U += cur_U * weight + # U = scale(U.todense()) + # U = normalize(U.todense(), norm='l2', axis=1) + return scale(U.toarray()) if type(U) == csr_matrix else scale(U) + + +# A is always the adjacency matrix +# the choice between adj matrix and trans matrix is decided in the conf +def fastrp_wrapper(A, conf): + U_list = fastrp_projection( + A, + q=len(conf["weights"]), + dim=conf["dim"], + projection_method=conf["projection_method"], + input_matrix=conf["input_matrix"], + alpha=conf["alpha"], + ) + U = fastrp_merge(U_list, conf["weights"], conf["normalization"]) + return U + + +def get_emb_filename(prefix, conf): + return ( + prefix + + "-dim=" + + str(conf["dim"]) + + ",projection_method=" + + conf["projection_method"] + + ",input_matrix=" + + conf["input_matrix"] + + ",normalization=" + + str(conf["normalization"]) + + ",weights=" + + ( + ",".join(map(str, conf["weights"])) + if conf["weights"] is not None + else "None" + ) + + ",alpha=" + + (str(conf["alpha"]) if "alpha" in conf else "") + + ",C=" + + (str(conf["C"]) if "alpha" in conf else "1.0") + + ".mat" + ) diff --git a/tests/test/baseline/create_baselines.py b/tests/test/baseline/create_baselines.py new file mode 100644 index 00000000..b2e0a946 --- /dev/null +++ b/tests/test/baseline/create_baselines.py @@ -0,0 +1,6 @@ +import degree_cent_baseline +import fast_rp_baseline + +if __name__ == "__main__": + degree_cent_baseline.run() + fast_rp_baseline.run() diff --git a/tests/test/baseline/degree_cent_baseline.py b/tests/test/baseline/degree_cent_baseline.py new file mode 100644 index 00000000..9791226d --- /dev/null +++ b/tests/test/baseline/degree_cent_baseline.py @@ -0,0 +1,228 @@ +import csv +import json +from functools import partial + +import networkx as nx +import numpy as np +from algos import run_degree_baseline, run_degree_baseline_complete, weighted_deg_cent +from tqdm import tqdm + +data_path_root = "data/" +baseline_path_root = f"{data_path_root}/baseline/" + + +def create_graph(edges, weights=False, directed=False): + if directed: + g = nx.DiGraph() + else: + g = nx.Graph() + if weights: + # make weights floats + edges = [[a, b, float(c)] for a, b, c in edges] + g.add_weighted_edges_from(edges) + else: + g.add_edges_from(edges) + return g + + +def create_degree_baseline(paths): + t = tqdm(paths, desc="Creating baselines") + for p, out_path, fn, m in t: + t.set_postfix_str(out_path.split("/")[-1].split(".")[0]) + with open(p) as f: + edges = np.array(list(csv.reader(f))) + + directed = True if "Directed" in out_path else False + weights = True if "Weighted" in out_path else False + g = create_graph(edges, weights, directed) + + # from matplotlib import pyplot as plt + # pos = nx.drawing.layout.kamada_kawai_layout(g) + # nx.draw(g, pos) + # nx.draw_networkx_labels(g, pos, {n: n for n in g.nodes}) + # plt.savefig(f"{out_path.split('/')[-1]}.png") + + res = fn(g, m) + with open(out_path, "w") as f: + json.dump(res, f) # , indent=2) + + +def run(): + # (data, output_path, fun, metric) + paths = [ + # unweighted + ( + f"{data_path_root}/unweighted_edges/complete_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/Complete.json", + run_degree_baseline_complete, + None, + ), + ( + f"{data_path_root}/unweighted_edges/line_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/Line.json", + run_degree_baseline, + nx.centrality.degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/ring_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/Ring.json", + run_degree_baseline, + nx.centrality.degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/hubspoke_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/Hub_Spoke.json", + run_degree_baseline, + nx.centrality.degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/tree_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/Tree.json", + run_degree_baseline, + nx.centrality.degree_centrality, + ), + # in_degree + ( + f"{data_path_root}/unweighted_edges/line_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/in_degree/Line_Directed.json", + run_degree_baseline, + nx.centrality.in_degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/ring_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/in_degree/Ring_Directed.json", + run_degree_baseline, + nx.centrality.in_degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/hubspoke_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/in_degree/Hub_Spoke_Directed.json", + run_degree_baseline, + nx.centrality.in_degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/tree_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/in_degree/Tree_Directed.json", + run_degree_baseline, + nx.centrality.in_degree_centrality, + ), + # out_degree + ( + f"{data_path_root}/unweighted_edges/line_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/out_degree/Line_Directed.json", + run_degree_baseline, + nx.centrality.out_degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/ring_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/out_degree/Ring_Directed.json", + run_degree_baseline, + nx.centrality.out_degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/hubspoke_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/out_degree/Hub_Spoke_Directed.json", + run_degree_baseline, + nx.centrality.out_degree_centrality, + ), + ( + f"{data_path_root}/unweighted_edges/tree_edges.csv", + f"{baseline_path_root}/centrality/degree_centrality/out_degree/Tree_Directed.json", + run_degree_baseline, + nx.centrality.out_degree_centrality, + ), + # weighted + ( + f"{data_path_root}/weighted_edges/complete_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/Complete_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent), + ), + ( + f"{data_path_root}/weighted_edges/line_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/Line_Weighted.json", + run_degree_baseline, + weighted_deg_cent, + ), + ( + f"{data_path_root}/weighted_edges/ring_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/Ring_Weighted.json", + run_degree_baseline, + weighted_deg_cent, + ), + ( + f"{data_path_root}/weighted_edges/hubspoke_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/Hub_Spoke_Weighted.json", + run_degree_baseline, + weighted_deg_cent, + ), + ( + f"{data_path_root}/weighted_edges/tree_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/Tree_Weighted.json", + run_degree_baseline, + weighted_deg_cent, + ), + # in_degree + ( + f"{data_path_root}/weighted_edges/complete_edges_directed.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/in_degree/Complete_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="in"), + ), + ( + f"{data_path_root}/weighted_edges/line_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/in_degree/Line_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="in"), + ), + ( + f"{data_path_root}/weighted_edges/ring_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/in_degree/Ring_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="in"), + ), + ( + f"{data_path_root}/weighted_edges/hubspoke_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/in_degree/Hub_Spoke_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="in"), + ), + ( + f"{data_path_root}/weighted_edges/tree_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/in_degree/Tree_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="in"), + ), + # out_degree + ( + f"{data_path_root}/weighted_edges/complete_edges_directed.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/out_degree/Complete_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="out"), + ), + ( + f"{data_path_root}/weighted_edges/line_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/out_degree/Line_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="out"), + ), + ( + f"{data_path_root}/weighted_edges/ring_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/out_degree/Ring_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="out"), + ), + ( + f"{data_path_root}/weighted_edges/hubspoke_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/out_degree/Hub_Spoke_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="out"), + ), + ( + f"{data_path_root}/weighted_edges/tree_edges.csv", + f"{baseline_path_root}/centrality/weighted_degree_centrality/out_degree/Tree_Directed_Weighted.json", + run_degree_baseline, + partial(weighted_deg_cent, dir="out"), + ), + ] + create_degree_baseline(paths) diff --git a/tests/test/baseline/fast_rp_baseline.py b/tests/test/baseline/fast_rp_baseline.py new file mode 100644 index 00000000..1b2ff5a4 --- /dev/null +++ b/tests/test/baseline/fast_rp_baseline.py @@ -0,0 +1,44 @@ +import gzip +import json + +import networkx as nx +import numpy as np +import pandas as pd +from algos import fastrp +from dotenv import load_dotenv +from pyTigerGraph.datasets import Datasets + +load_dotenv() +data_path_root = "data" +baseline_path_root = f"{data_path_root}/baseline" + + +def run(ds_name="Cora"): + dataset = Datasets(ds_name) + edges = pd.read_csv(dataset.tmp_dir + f"/{ds_name}/edges.csv", header=None) + edges.columns = ["src", "tgt"] + + g = nx.Graph() + g.add_edges_from(edges.to_numpy()) + node_ids = sorted(list(g.nodes)) + A = nx.adjacency_matrix(g, nodelist=node_ids) + conf = { + "weights": [1, 2, 4], + "dim": 8, + # "projection_method": "sparse", + "projection_method": "gaussian", + "input_matrix": "trans", + "alpha": -0.628, + "normalization": False, + } + + vecs = fastrp(A, conf) + + assert len(vecs) == len(node_ids) + + res = {str(k): list(v) for k, v in zip(node_ids, vecs)} + with gzip.open(f"{baseline_path_root}/ml/fastRP.json.gz", "wb") as f: + f.write(json.dumps(res).encode()) + + with gzip.open(f"{baseline_path_root}/ml/fastRP.json.gz", "rb") as f: + d = json.load(f) diff --git a/tests/test/setup.py b/tests/test/setup.py index 406077c3..fad28088 100644 --- a/tests/test/setup.py +++ b/tests/test/setup.py @@ -1,17 +1,31 @@ import json import os import re +import time import pyTigerGraph as tg -import util from dotenv import load_dotenv from pyTigerGraph.datasets import Datasets -from tqdm import tqdm +from tqdm import tqdm, trange + +import util load_dotenv() graph_name = "graph_algorithms_testing" pattern = re.compile(r'"name":\s*"tg_.*"') + +def add_reverse_edge(ds: Datasets): + with open(f"{dataset.tmp_dir}/{ds.name}/create_schema.gsql") as f: + schema: str = f.read() + with open(f"{dataset.tmp_dir}/{ds.name}/create_schema.gsql", "w") as f: + schema = schema.replace( + "ADD DIRECTED EDGE Cite (from Paper, to Paper, time Int, is_train Bool, is_val Bool);", + 'ADD DIRECTED EDGE Cite (from Paper, to Paper, time Int, is_train Bool, is_val Bool) WITH REVERSE_EDGE="reverse_Cite";', + ) + f.write(schema) + + if __name__ == "__main__": host_name = os.getenv("HOST_NAME") user_name = os.getenv("USER_NAME") @@ -28,9 +42,14 @@ if res["error"]: exit(1) # load the data + dataset = Datasets("Cora") + add_reverse_edge(dataset) + conn.ingestDataset(dataset, getToken=True) + dataset = Datasets("graph_algorithms_testing") conn.ingestDataset(dataset, getToken=True) + conn.graphname = graph_name # install the queries feat = conn.gds.featurizer() installed_queries = util.get_installed_queries(conn) @@ -43,3 +62,5 @@ print(q) feat.installAlgorithm(q) + for _ in trange(30, desc="Sleeping while data loads"): + time.sleep(1) diff --git a/tests/test/test_centrality.py b/tests/test/test_centrality.py index e228f12f..6f36295b 100644 --- a/tests/test/test_centrality.py +++ b/tests/test/test_centrality.py @@ -1,36 +1,43 @@ import json import pytest + import util class TestCentrality: feat = util.get_featurizer() - # undirected graphs - graph_types1 = ["Empty", "Line", "Ring", "Hub_Spoke", "Tree"] - # directed graphs - graph_types2 = [ + undirected_graphs = [ + "Empty", + "Line", + "Ring", + "Hub_Spoke", + "Tree", + ] + directed_graphs = [ "Line_Directed", "Ring_Directed", "Hub_Spoke_Directed", "Tree_Directed", ] - # weighted undirected graphs - graph_types3 = [ + weighted_undirected_graphs = [ "Line_Weighted", "Ring_Weighted", "Hub_Spoke_Weighted", "Tree_Weighted", ] - # weighted directed graphs - graph_types4 = [ + weighted_directed_graphs = [ "Line_Directed_Weighted", "Ring_Directed_Weighted", "Hub_Spoke_Directed_Weighted", "Tree_Directed_Weighted", + "Complete_Directed_Weighted", + ] + complete_graphs = [ + "Complete", ] - @pytest.mark.parametrize("test_name", graph_types1) + @pytest.mark.parametrize("test_name", undirected_graphs) def test_degree_centrality1(self, test_name): params = { "v_type_set": ["V20"], @@ -43,24 +50,22 @@ def test_degree_centrality1(self, test_name): "result_attribute": "", "file_path": "", } - with open( - f"data/baseline/graph_algorithms_baselines/centrality/degree_centrality/{test_name}.json" - ) as f: + with open(f"data/baseline/centrality/degree_centrality/{test_name}.json") as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_degree_cent", params=params) result = sorted(result[0]["top_scores"], key=lambda x: x["Vertex_ID"]) baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) + # pytest.fail(str(result)) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types2) + @pytest.mark.parametrize("test_name", directed_graphs) def test_degree_centrality2(self, test_name): params = { "v_type_set": ["V20"], @@ -74,7 +79,7 @@ def test_degree_centrality2(self, test_name): "file_path": "", } with open( - f"data/baseline/graph_algorithms_baselines/centrality/degree_centrality/in_degree/{test_name}.json" + f"data/baseline/centrality/degree_centrality/in_degree/{test_name}.json" ) as f: baseline = json.load(f) @@ -83,14 +88,13 @@ def test_degree_centrality2(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types2) + @pytest.mark.parametrize("test_name", directed_graphs) def test_degree_centrality3(self, test_name): params = { "v_type_set": ["V20"], @@ -104,7 +108,7 @@ def test_degree_centrality3(self, test_name): "file_path": "", } with open( - f"data/baseline/graph_algorithms_baselines/centrality/degree_centrality/out_degree/{test_name}.json" + f"data/baseline/centrality/degree_centrality/out_degree/{test_name}.json" ) as f: baseline = json.load(f) @@ -113,14 +117,37 @@ def test_degree_centrality3(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') + + @pytest.mark.parametrize("test_name", complete_graphs) + def test_degree_centrality4(self, test_name): + params = { + "v_type_set": ["V8"], + "e_type_set": [test_name], + "reverse_e_type_set": ["reverse_" + test_name], + "in_degree": False, + "out_degree": True, + "print_results": True, + } + with open(f"data/baseline/centrality/degree_centrality/{test_name}.json") as f: + baseline = json.load(f) - @pytest.mark.parametrize("test_name", graph_types3) + result = self.feat.runAlgorithm("tg_degree_cent", params=params) + result = sorted(result[0]["top_scores"], key=lambda x: x["Vertex_ID"]) + baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) + + for b in baseline: + for r in result: + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') + + @pytest.mark.parametrize("test_name", weighted_undirected_graphs) def test_weighted_degree_centrality1(self, test_name): params = { "v_type": "V20", @@ -135,25 +162,26 @@ def test_weighted_degree_centrality1(self, test_name): "file_path": "", } with open( - f"data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/{test_name}.json" + f"data/baseline/centrality/weighted_degree_centrality/{test_name}.json" ) as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_weighted_degree_cent", params=params) result = sorted(result[0]["top_scores"], key=lambda x: x["Vertex_ID"]) baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) + print(result) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types4) + @pytest.mark.parametrize("test_name", weighted_directed_graphs) def test_weighted_degree_centrality2(self, test_name): + vt = "V20" if "Complete" not in test_name else "V8" params = { - "v_type": "V20", + "v_type": vt, "e_type": test_name, "reverse_e_type": "reverse_" + test_name, "weight_attribute": "weight", @@ -165,7 +193,7 @@ def test_weighted_degree_centrality2(self, test_name): "file_path": "", } with open( - f"data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/in_degree/{test_name}.json" + f"data/baseline/centrality/weighted_degree_centrality/in_degree/{test_name}.json" ) as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_weighted_degree_cent", params=params) @@ -173,17 +201,17 @@ def test_weighted_degree_centrality2(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types4) + @pytest.mark.parametrize("test_name", weighted_directed_graphs) def test_weighted_degree_centrality3(self, test_name): + vt = "V20" if "Complete" not in test_name else "V8" params = { - "v_type": "V20", + "v_type": vt, "e_type": test_name, "reverse_e_type": "reverse_" + test_name, "weight_attribute": "weight", @@ -195,7 +223,7 @@ def test_weighted_degree_centrality3(self, test_name): "file_path": "", } with open( - f"data/baseline/graph_algorithms_baselines/centrality/weighted_degree_centrality/out_degree/{test_name}.json" + f"data/baseline/centrality/weighted_degree_centrality/out_degree/{test_name}.json" ) as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_weighted_degree_cent", params=params) @@ -203,14 +231,13 @@ def test_weighted_degree_centrality3(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types1) + @pytest.mark.parametrize("test_name", undirected_graphs) def test_closeness_centrality(self, test_name): params = { "v_type_set": ["V20"], @@ -225,7 +252,7 @@ def test_closeness_centrality(self, test_name): "display_edges": False, } with open( - f"data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/{test_name}.json" + f"data/baseline/centrality/closeness_centrality/{test_name}.json" ) as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_closeness_cent", params=params) @@ -233,14 +260,13 @@ def test_closeness_centrality(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types2) + @pytest.mark.parametrize("test_name", directed_graphs) def test_closeness_centrality2(self, test_name): params = { "v_type_set": ["V20"], @@ -255,7 +281,7 @@ def test_closeness_centrality2(self, test_name): "display_edges": False, } with open( - f"data/baseline/graph_algorithms_baselines/centrality/closeness_centrality/{test_name}.json" + f"data/baseline/centrality/closeness_centrality/{test_name}.json" ) as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_closeness_cent", params=params) @@ -263,14 +289,13 @@ def test_closeness_centrality2(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types1) + @pytest.mark.parametrize("test_name", undirected_graphs) def test_harmonic_centrality(self, test_name): params = { "v_type_set": ["V20"], @@ -285,7 +310,7 @@ def test_harmonic_centrality(self, test_name): "display_edges": False, } with open( - f"data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/{test_name}.json" + f"data/baseline/centrality/harmonic_centrality/{test_name}.json" ) as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_harmonic_cent", params=params) @@ -293,14 +318,13 @@ def test_harmonic_centrality(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types2) + @pytest.mark.parametrize("test_name", directed_graphs) def test_harmonic_centrality2(self, test_name): params = { "v_type_set": ["V20"], @@ -315,7 +339,7 @@ def test_harmonic_centrality2(self, test_name): "display_edges": False, } with open( - f"data/baseline/graph_algorithms_baselines/centrality/harmonic_centrality/{test_name}.json" + f"data/baseline/centrality/harmonic_centrality/{test_name}.json" ) as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_harmonic_cent", params=params) @@ -323,14 +347,13 @@ def test_harmonic_centrality2(self, test_name): baseline = sorted(baseline[0]["top_scores"], key=lambda x: x["Vertex_ID"]) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types1 + graph_types2) + @pytest.mark.parametrize("test_name", undirected_graphs + directed_graphs) def test_article_rank(self, test_name): params = { "v_type": "V20", @@ -343,9 +366,7 @@ def test_article_rank(self, test_name): "result_attribute": "", "file_path": "", } - with open( - f"data/baseline/graph_algorithms_baselines/centrality/article_rank/{test_name}.json" - ) as f: + with open(f"data/baseline/centrality/article_rank/{test_name}.json") as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_article_rank", params=params) result = sorted(result[0]["@@top_scores_heap"], key=lambda x: x["Vertex_ID"]) @@ -354,14 +375,13 @@ def test_article_rank(self, test_name): ) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') - @pytest.mark.parametrize("test_name", graph_types1 + graph_types2) + @pytest.mark.parametrize("test_name", undirected_graphs + directed_graphs) def test_pagerank(self, test_name): params = { "v_type": "V20", @@ -375,9 +395,7 @@ def test_pagerank(self, test_name): "file_path": "", "display_edges": False, } - with open( - f"data/baseline/graph_algorithms_baselines/centrality/pagerank/{test_name}.json" - ) as f: + with open(f"data/baseline/centrality/pagerank/{test_name}.json") as f: baseline = json.load(f) result = self.feat.runAlgorithm("tg_pagerank", params=params) result = sorted(result[0]["@@top_scores_heap"], key=lambda x: x["Vertex_ID"]) @@ -386,9 +404,8 @@ def test_pagerank(self, test_name): ) for b in baseline: - found = False for r in result: - if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] == r["score"]: - found = True - if not found: - pytest.fail() + if r["Vertex_ID"] == b["Vertex_ID"] and r["score"] != pytest.approx( + b["score"] + ): + pytest.fail(f'{r["score"]} != {b["score"]}') diff --git a/tests/test/test_ml.py b/tests/test/test_ml.py new file mode 100644 index 00000000..00cfc858 --- /dev/null +++ b/tests/test/test_ml.py @@ -0,0 +1,56 @@ +import gzip +import json + +import numpy as np +import pytest +from dotenv import load_dotenv + +from util import get_featurizer + +load_dotenv() +data_path_root = "data" +baseline_path_root = f"{data_path_root}/baseline" + + +def cos_sim(x, y): + x_mag = np.linalg.norm(x) + y_mag = np.linalg.norm(y) + + return np.dot(x, y) / (x_mag * y_mag) + + +class TestML: + feat = get_featurizer("Cora") + + def test_fastRP(self): + params = { + "v_type_set": ["Paper"], + "e_type_set": ["Cite", "reverse_Cite"], + "output_v_type_set": ["Paper"], + "iteration_weights": "1,2,4", + "beta": -0.1, + "embedding_dimension": 8, + "embedding_dim_map": [], + "default_length": 8, + "sampling_constant": 3, + "random_seed": 42, + "print_results": True, + } + + with gzip.open(f"{baseline_path_root}/ml/fastRP.json.gz", "rb") as f: + baseline = json.load(f) + + result = self.feat.runAlgorithm( + "tg_fastRP", + params=params, + ) + result = { + v["v_id"]: v["attributes"]["res.@final_embedding_list"] + for v in result[1]["res"] + } + threshold = 0.5 + for bk, bv in baseline.items(): + v = result[bk] + sim = abs(cos_sim(v, bv)) + if sim < threshold: + pytest.fail(f"cos-sim of ID: {bk} is {sim} (< threshold of {threshold}") diff --git a/tests/test/util.py b/tests/test/util.py index 3418a913..ca26c785 100644 --- a/tests/test/util.py +++ b/tests/test/util.py @@ -6,9 +6,7 @@ load_dotenv() -def get_featurizer(): - graph_name = "graph_algorithms_testing" - +def get_featurizer(graph_name="graph_algorithms_testing"): host_name = os.getenv("HOST_NAME") user_name = os.getenv("USER_NAME") password = os.getenv("PASS") diff --git a/tools/scripts/bash_functions b/tools/scripts/bash_functions index b2d060bc..a55b0c07 100644 --- a/tools/scripts/bash_functions +++ b/tools/scripts/bash_functions @@ -151,7 +151,8 @@ function decrypt () { else QNAME=$1 fi - codegen_path="$(getAppRoot)/dev/gdk/gsql/.tmp/codeGen" + version=$(basename "$(getAppRoot)") + codegen_path="$(gadmin config get System.DataRoot)/gsql/${version}/.tmp/codeGen" if [[ x$QNAME != x ]] then FILES=$(ls ${codegen_path}/*$QNAME.cpp 2>/dev/null) @@ -181,7 +182,8 @@ function _complete_decrypt { fi local cur=${COMP_WORDS[COMP_CWORD]} - local QUERIES=$(ls $(getAppRoot)/dev/gdk/gsql/.tmp/codeGen/${cur}*.cpp 2>/dev/null) + local version=$(basename "$(getAppRoot)") + local QUERIES=$(ls "$(gadmin config get System.DataRoot)/gsql/${version}/.tmp/codeGen/${cur}*.cpp" 2>/dev/null) for QUERY in $QUERIES; do local filename=$(basename $QUERY)