Catalog Cypher Endpoints¶
- class graphdatascience.procedure_surface.cypher.catalog.catalog_cypher_endpoints.CatalogCypherEndpoints¶
- __new__(**kwargs)¶
- construct(graph_name: str, nodes: DataFrame | list[DataFrame], relationships: DataFrame | list[DataFrame] | None = None, concurrency: int | None = None, undirected_relationship_types: list[str] | None = None, inverse_indexed_relationship_types: list[str] | None = None, batch_size: int = 100000, overwrite: bool = False) Graph¶
Construct a graph from a list of node and relationship dataframes.
- Parameters:
graph_name (str) – Name of the graph to be created
nodes (DataFrame | list[DataFrame]) –
Node dataframes. A dataframe should follow the schema:
nodeId to identify uniquely the node overall dataframes
labels to specify the labels of the node as a list of strings (optional)
other columns are treated as node properties
relationships (DataFrame | list[DataFrame] | None) –
Relationship dataframes. A dataframe should follow the schema:
sourceNodeId to identify the start node of the relationship
targetNodeId to identify the end node of the relationship
relationshipType to specify the type of the relationship (optional)
other columns are treated as relationship properties
concurrency (int | None) – Number of concurrent threads to use.
undirected_relationship_types (list[str] | None) – List of relationship types to treat as undirected.
inverse_indexed_relationship_types (list[str] | None) – List of relationship types for which to create an inverse index.
batch_size (int) – Batch size to use when sending data to GDS.
overwrite (bool) – If True, drop an existing graph with the same name before constructing the new one. Defaults to False.
- Returns:
Constructed graph object.
- Return type:
- property datasets: DatasetEndpoints¶
Endpoints for loading predefined datasets into the graph catalog.
- drop(G: Graph | str | List[Graph | str], fail_if_missing: bool = True, *, db_name: str | None = None, username: str | None = None) List[GraphInfo]¶
Drop a graph from the graph catalog.
- Parameters:
G (Graph | str | List[Graph | str]) – Graphs to drop by name or object.
fail_if_missing (bool) – Whether to fail if the graph is missing.
db_name (str | None) – The name of the database the graph belongs to. Defaults to the current database.
username (str | None) – As an administrator, drop a graph owned by a different user.
- Returns:
Metadata of the dropped graphs.
- Return type:
List[GraphInfo]
- property export: GraphExportEndpoints¶
Endpoints for exporting graphs to a new database or CSV files.
- filter(G: Graph, graph_name: str, node_filter: str, relationship_filter: str, parameters: dict[str, Any] | None = None, concurrency: int | None = None, job_id: str | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, overwrite: bool = False) GraphWithFilterResult¶
Create a subgraph of a graph based on a filter expression.
- Parameters:
G (Graph) – Graph object to use
graph_name (str) – Name of the graph to be created
node_filter (str) – Filter expression for nodes
relationship_filter (str) – Filter expression for relationships
parameters (dict[str, Any] | None) – A map of user-defined query parameters that are passed into the node and relationship filters.
concurrency (int | None) – Number of concurrent threads to use.
job_id (str | None) – Identifier for the computation.
sudo (bool) – Disable the memory guard.
log_progress (bool) – Display progress logging.
username (str | None) – As an administrator, impersonate a different user for accessing their graphs.
overwrite (bool) – If True, drop an existing graph with the same name before creating the filtered subgraph. Defaults to False.
- Returns:
tuple of the filtered graph object and the information like graph name, node count, relationship count, etc.
- Return type:
- generate(graph_name: str, node_count: int, average_degree: float, *, relationship_distribution: str | None = 'UNIFORM', relationship_seed: int | None = None, relationship_property: RelationshipPropertySpec | None = None, orientation: str | None = 'NATURAL', aggregation: str | None = 'NONE', allow_self_loops: bool | None = False, read_concurrency: int | None = None, job_id: str | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, overwrite: bool = False) GraphWithGenerationStats¶
Generates a random graph and store it in the graph catalog.
- Parameters:
graph_name (str) – Name of the graph to be created
node_count (int) – The number of nodes in the generated graph
average_degree (float) – The average out-degree of the generated nodes
relationship_distribution (str | None) – Determines the relationship distribution strategy.
relationship_seed (int | None) – Seed value for generating deterministic relationships.
relationship_property (RelationshipPropertySpec | None) – Configure generated relationship properties.
orientation (str | None) – Specifies the orientation of the generated relationships.
aggregation (str | None) – The relationship aggregation method of Relationship Projection.
allow_self_loops (bool | None) – Whether nodes in the graph can have relationships where start and end nodes are the same.
read_concurrency (int | None) – Number of concurrent threads/processes to use during graph generation.
job_id (str | None) – Identifier for the computation.
sudo (bool) – Disable the memory guard.
log_progress (bool) – Display progress logging.
username (str | None) – As an administrator, impersonate a different user for accessing their graphs.
overwrite (bool) – If True, drop an existing graph with the same name before generating the new one. Defaults to False.
- Returns:
tuple of the generated graph object and the result object containing stats about the generation.
- Return type:
- list(G: Graph | str | None = None) list[GraphInfoWithDegrees]¶
List graphs in the graph catalog.
- property node_labels: NodeLabelEndpoints¶
Endpoints for node label operations.
- property node_properties: NodePropertiesEndpoints¶
Endpoints for node property operations.
- property node_property: NodePropertyEndpoints¶
Endpoints for streaming a single node property.
- property relationship_properties: RelationshipPropertiesEndpoints¶
Endpoints for streaming several relationship properties.
- property relationship_property: RelationshipPropertyEndpoints¶
Endpoints for streaming a single relationship property.
- property relationships: RelationshipsEndpoints¶
Endpoints for relationship operations.
- property sample: GraphSamplingEndpoints¶
Endpoints for graph sampling.
- pydantic model graphdatascience.procedure_surface.cypher.catalog.GraphCypherProjectResult¶
- pydantic model graphdatascience.procedure_surface.cypher.catalog.GraphProjectResult¶
- class graphdatascience.procedure_surface.cypher.catalog.GraphWithCypherProjectResult¶
GraphWithCypherProjectResult(graph, result)
- static __new__(_cls, graph: Graph, result: GraphCypherProjectResult)¶
Create new instance of GraphWithCypherProjectResult(graph, result)
- Parameters:
graph (Graph)
result (GraphCypherProjectResult)
- result: GraphCypherProjectResult¶
Alias for field number 1
- class graphdatascience.procedure_surface.cypher.catalog.GraphWithProjectResult¶
GraphWithProjectResult(graph, result)
- static __new__(_cls, graph: Graph, result: GraphProjectResult)¶
Create new instance of GraphWithProjectResult(graph, result)
- Parameters:
graph (Graph)
result (GraphProjectResult)
- result: GraphProjectResult¶
Alias for field number 1
- class graphdatascience.procedure_surface.cypher.catalog.ProjectCypherEndpoints¶
Endpoints for projecting a graph into the catalog against a Cypher-based database.
Exposes
native()forgds.graph.project.native,estimate()forgds.graph.project.estimateandcypher()forgds.graph.project.cypher.- cypher(query: str, **params: Any) GraphWithCypherProjectResult¶
Project a graph using a Cypher projection.
The provided query must end with a
RETURN gds.graph.project(...)aggregation call.- Parameters:
- Returns:
The projected graph and metadata about the projection.
- Return type:
- estimate(node_projection: str | list[str] | dict[str, Any] | None = None, relationship_projection: str | list[str] | dict[str, Any] | None = None, node_properties: str | list[str] | dict[str, Any] | None = None, relationship_properties: str | list[str] | dict[str, Any] | None = None, read_concurrency: int | None = None, sudo: bool = False, username: str | None = None) EstimationResult¶
Estimate the memory consumption of a native graph projection.
- Parameters:
node_projection (str | list[str] | dict[str, Any] | None) – The node projection used for the projection. A single label, a list of labels, or a projection map.
relationship_projection (str | list[str] | dict[str, Any] | None) – The relationship projection used for the projection. A single type, a list of types, or a projection map.
node_properties (str | list[str] | dict[str, Any] | None) – Node properties to load during the projection.
relationship_properties (str | list[str] | dict[str, Any] | None) – Relationship properties to load during the projection.
read_concurrency (int | None) – Number of concurrent threads used during the projection.
sudo (bool) – Disable the memory guard.
username (str | None) – As an administrator, impersonate a different user for the estimation.
- Returns:
The result of the estimation, including the required memory and node/relationship counts.
- Return type:
- native(graph_name: str, node_projection: str | list[str] | dict[str, Any] | None = None, relationship_projection: str | list[str] | dict[str, Any] | None = None, node_properties: str | list[str] | dict[str, Any] | None = None, relationship_properties: str | list[str] | dict[str, Any] | None = None, read_concurrency: int | None = None, job_id: str | None = None, sudo: bool = False, username: str | None = None, log_progress: bool = True, overwrite: bool = False) GraphWithProjectResult¶
Project a graph into the catalog using a native projection (
gds.graph.project).
- class graphdatascience.procedure_surface.cypher.pathfinding.dag_cypher_endpoints.DagCypherEndpoints¶
- __init__(query_runner: QueryRunner)¶
- Parameters:
query_runner (QueryRunner)
- __new__(**kwargs)¶
- class graphdatascience.procedure_surface.cypher.list_progress_cypher_endpoint.ListProgressCypherEndpoint¶
- __init__(query_runner: QueryRunner)¶
- Parameters:
query_runner (QueryRunner)
- __new__(**kwargs)¶