Featurizer

The Featurizer class provides methods for installing and running Graph Data Science Algorithms onto a TigerGraph server.

listAlgorithms()

listAlgorithms(category: str = None)

Print the list of available algorithms in GDS.

Parameter:

  • category (str): The class of the algorithms, if it is None the entire list will be printed out.

Returns:

Prints the information for algorithms within the specified category.

installAlgorithm()

installAlgorithm(query_name: str, query_path: str = None, global_change: bool = False) → str

Checks if the query is already installed. If the query is not installed, it installs the query and changes the schema if an attribute needs to be added.

Parameters:

query_name (str): The name of query to be installed. * query_path (str): If using a custom query, the path to the .gsql file that contains the query. Note: you must have the query_name parameter match the name of the query in the file. * global_change (bool): False by default. Set to true if you want to run GLOBAL SCHEMA_CHANGE JOB. For algorithms that are not schema free we need to specify this argument.
See the https://docs.tigergraph.com/gsql-ref/current/ddl-and-loading/modifying-a-graph-schema#_global_vs_local_schema_changes.[schema change documentation] for more details.

Returns:

String of query name installed.

runAlgorithm()

runAlgorithm(query_name: str, params: dict = None, feat_name: str = None, feat_type: str = None, custom_query: bool = False, schema_name: list = None, global_schema: bool = False, timeout: int = 2147480, sizeLimit: int = None) → Any

Runs an installed query. The query must be already created and installed in the graph. If the query accepts input parameters and the parameters have not been provided, calling this function runs the query with the default values for the parameters. If the there isn’t a default value in the query definition and no parameters are provided, the function raises a ValueError.

Parameters:

  • query_name (str): The name of the query to be executed.

  • params (dict): Query parameters. A dictionary. feat_name (str): An attribute name that needs to be added to the vertex/edge

  • feat_type (str): Type of attribute that needs to be added to the vertex/edge. Only needed if custom_query is set to True.

  • custom_query (bool): If the query is a custom query. Defaults to False.

  • schema_name: List of Vertices/Edges that the attr_name need to added to them.

  • global_schema (bool): False by default. Set to true if you want to run GLOBAL SCHEMA_CHANGE JOB.
    See the https://docs.tigergraph.com/gsql-ref/current/ddl-and-loading/modifying-a-graph-schema#_global_vs_local_schema_changes.[schema change documentation] for more details.

  • timeout (int): Maximum duration for successful query execution (in milliseconds).

  • sizeLimit (int): Maximum size of response (in bytes).

Returns:

The output of the query, a list of output elements (vertex sets, edge sets, variables, accumulators, etc.)