You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "Munmud (via GitHub)" <gi...@apache.org> on 2023/04/26 02:02:35 UTC
[GitHub] [age] Munmud opened a new issue, #852: Which Tech/Algorithm is used to generate id automatically when creating new nodes and edges ?
Munmud opened a new issue, #852:
URL: https://github.com/apache/age/issues/852
We are developing python support for Networkx. While building the project, we need to know the process of generating id no for that are assigned automatically when creating new nodes and edges.
--
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: dev-unsubscribe@age.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] aru-d-at commented on issue #852: Which Tech/Algorithm is used to generate id automatically when creating new nodes and edges ?
Posted by "aru-d-at (via GitHub)" <gi...@apache.org>.
aru-d-at commented on issue #852:
URL: https://github.com/apache/age/issues/852#issuecomment-1524225164
Stepping through the code, it seems the Id is calculated through Postgres using the `stdlib-bsearch` library and calling function `bsearch()`.
With the `ExecEvalStepOp` from _postgres/src/backend/executor/execExprInterp.c_ calling the function in multiple iterations to go through the existing Id's and evaluate the new Id's viability.
The operation occurs similarly with the label_id's. Besides calling the previously mentioned function, it also calls the following (to name a few):
* `_hash_any_` at _postgres/src/backend/utils/hashfn.c_
* `_calc_bucket_` at _postgres/src/backend/utils/dynahash.c_
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] kenwoon commented on issue #852: Which Tech/Algorithm is used to generate id automatically when creating new nodes and edges ?
Posted by "kenwoon (via GitHub)" <gi...@apache.org>.
kenwoon commented on issue #852:
URL: https://github.com/apache/age/issues/852#issuecomment-1529236152
I have found information from the official [master documentation](https://age.apache.org/age-manual/master/intro/types.html#graphid) as follows:
> An entity is assigned a set of properties, each of which are uniquely identified in the set by the irrespective property keys. Simple entities are assigned a unique `graphid`. A `graphid` is a unique composition of the entity’s label id and a unique sequence assigned to each label.
From what I can find, `graphid`s are mainly referenced from the 'graphid.c' file, which is likely responsible for the creation of GRAPHID Oids. The function `make_graphid()` takes in the `label_id` and `entry_id` generated by the `PG_GETARG_INT32()` and `PG_GETARG_INT64()` functions, defined in the `graphid.h` header file.
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] Zainab-Saad commented on issue #852: Which Tech/Algorithm is used to generate id automatically when creating new nodes and edges ?
Posted by "Zainab-Saad (via GitHub)" <gi...@apache.org>.
Zainab-Saad commented on issue #852:
URL: https://github.com/apache/age/issues/852#issuecomment-1522934924
The 16 digit ID of nodes and edges is generated by applying certain masking algorithm on the ID of label associated with that node/edge. Since the labels are actually tables that store the nodes/edges associated to them in that table and the ID of these tables are generated by a sequence (you can find the ID of a label table using `SELECT * FROM ag_label` --> This outputs a column named id that is basically the label ID I am talking about.)
In order to actually see how the IDs are given to nodes/edges, debug a simple CREATE statement with breakpoints on
1. create_vertex
2. ExecEvalExpr
This will give you a more clear picture
Hope it helps!
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] humzakt commented on issue #852: Which Tech/Algorithm is used to generate id automatically when creating new nodes and edges ?
Posted by "humzakt (via GitHub)" <gi...@apache.org>.
humzakt commented on issue #852:
URL: https://github.com/apache/age/issues/852#issuecomment-1526095090
Apache AGE is an extension of PostgreSQL, and it uses the underlying PostgreSQL database management system to store and manage graph data. When creating new nodes and edges, Apache AGE relies on PostgreSQL's internal mechanisms for generating unique IDs.
In PostgreSQL, the most common method for generating unique IDs is to use a SERIAL column or a sequence. A SERIAL column is essentially an auto-incrementing integer value backed by a sequence. When a new row is inserted, the SERIAL column will automatically be assigned a new value from the sequence.
For Apache AGE, the details of the unique ID generation for nodes and edges are internal to the extension, but it is likely that it uses a similar mechanism, such as a sequence or a custom ID generation algorithm built on top of PostgreSQL's features. The exact implementation details might not be publicly documented.
In any case, the ID generation mechanism ensures that each node and edge receives a unique identifier when they are created, which can be accessed and used in Cypher queries or other operations.
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] Munmud closed issue #852: Which Tech/Algorithm is used to generate id automatically when creating new nodes and edges ?
Posted by "Munmud (via GitHub)" <gi...@apache.org>.
Munmud closed issue #852: Which Tech/Algorithm is used to generate id automatically when creating new nodes and edges ?
URL: https://github.com/apache/age/issues/852
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org