- graph_function_name
- Name of the Graph Function.
- vertices_table
- Name of the vertices table.
- edges_table
- [Optional] Name of the edges table.
- vertexKey
- Key used for partitioning data in the vertices table.
- vertices_alias
- [Optional] Alias of the first input table.
- edges_alias
- [Optional] Alias of the second input table.
- sourceKey
- [Optional] Key used for partitioning data in the edges table.This key is analogous to a foreign key referencing the primary key column of the vertices table. This is somewhat like:
FROM vertices AS v INNER JOIN edges AS e ON e.sourceKey = v.vertexKey
- dim-table-1 … dim-table-n
- [Optional] Names of one or more dimension tables.
- argument-table-1 … argument-table-n
- [Optional] Names of one or more arguments.
- values-1 … values-n
- [Optional] Names of one or more values.
The optional AS vertices_alias and AS edges_alias clauses allow a single function to accept different vertex/edge tables as inputs because the function no longer must be hard-coded to use specific table names. For example, suppose that you have the following tables:
- phone_owner_vertices: Contains information about telephone owners
- phone_owner_edges: Contains information about the connections between phone owners (for example, how frequently owner X calls owner Y)
- email_owner_vertices: Contains information about email address owners
- email_owner_edges: Contains information about who emails whom
And suppose also that you have a function most_frequent_recipient(), which tells you for each vertex which other vertex the first vertex contacts most frequently.
With aliases, you can use the same function on different tables (as long as the tables have compatible columns, of course):
select most_frequent_recipient( on phone_owner_vertices AS vertices_alias partition by id on phone_owner_edges AS edges_alias partition by start_id ...) select most_frequent_recipient( on email_owner_vertices AS vertices_alias partition by id on email_owner_edges AS edges_alias partition by start_id ...)
If you didn’t have aliases, you would need to write two versions of that function, one for cell phones and one for email addresses, and then call those functions, for example:
select most_frequent_phonecall_recipient( on cell_phone_owner_vertices partition by id on cell_phone_owner_edges partition by start_id ...) select most_frequent_email_recipient( on email_owner_vertices partition by id on email_owner_edges partition by start_id ...)