You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by "MatheusFarias03 (via GitHub)" <gi...@apache.org> on 2023/04/24 23:29:53 UTC
[GitHub] [age] MatheusFarias03 opened a new pull request, #844: [Create Path Graph] - Implemented function for creating a Path Graph
MatheusFarias03 opened a new pull request, #844:
URL: https://github.com/apache/age/pull/844
This PR adds a new function `age_create_path` to the codebase that generates a path graph with `n` nodes, where each node is connected to its adjacent nodes. The edges can be set to be in one direction or in both directions (one edge that comes from the `start vertex` and points to the `end vertex` and one that comes from the `end vertex` and points at the `start vertex`). It is also possible to set the labels for both vertices and edges.
Syntax:
```sql
ag_catalog.age_create_path(graph_name Name, n int,
vertex_label_name Name DEFAULT = NULL,
edge_label_name Name DEFAULT = NULL,
bidirectional bool DEFAULT = true)
```
Query example:
```sql
SELECT age_create_path('path_graph_10_true', 10, 'PathVertex', 'PATH_EDGE', true);
SELECT * FROM path_graph_10_true."PATH_EDGE";
id | start_id | end_id | properties
------------------+-----------------+-----------------+------------
1125899906842625 | 844424930131977 | 844424930131978 | {}
1125899906842625 | 844424930131978 | 844424930131977 | {}
1125899906842626 | 844424930131976 | 844424930131977 | {}
1125899906842626 | 844424930131977 | 844424930131976 | {}
1125899906842627 | 844424930131975 | 844424930131976 | {}
1125899906842627 | 844424930131976 | 844424930131975 | {}
1125899906842628 | 844424930131974 | 844424930131975 | {}
1125899906842628 | 844424930131975 | 844424930131974 | {}
1125899906842629 | 844424930131973 | 844424930131974 | {}
1125899906842629 | 844424930131974 | 844424930131973 | {}
1125899906842630 | 844424930131972 | 844424930131973 | {}
1125899906842630 | 844424930131973 | 844424930131972 | {}
1125899906842631 | 844424930131971 | 844424930131972 | {}
1125899906842631 | 844424930131972 | 844424930131971 | {}
1125899906842632 | 844424930131970 | 844424930131971 | {}
1125899906842632 | 844424930131971 | 844424930131970 | {}
1125899906842633 | 844424930131969 | 844424930131970 | {}
1125899906842633 | 844424930131970 | 844424930131969 | {}
(18 rows)
```
Main motivation for this PR is that there is an open enhancement issue about it at #274 . Also, by adding this function we can simplify the process of generating path graphs and make our queries more efficient.
This PR includes regression tests for the new function to ensure that it works as expected and returns the correct output.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] MatheusFarias03 closed pull request #844: [Create Path Graph] - Implemented function for creating a Path Graph
Posted by "MatheusFarias03 (via GitHub)" <gi...@apache.org>.
MatheusFarias03 closed pull request #844: [Create Path Graph] - Implemented function for creating a Path Graph
URL: https://github.com/apache/age/pull/844
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org