Catalog Arrow Endpoints¶
- class graphdatascience.procedure_surface.arrow.catalog.catalog_arrow_endpoints.CatalogArrowEndpoints¶
- __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) List[GraphInfo]¶
Drop graphs from the graph catalog.
- 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:
- filter_async(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) ProjectionJobHandle¶
Kick off a graph filter operation and return a
ProjectionJobHandle.Unlike
filter(), this method does not block on completion.
- 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:
- generate_async(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) ProjectionJobHandle¶
Kick off a graph generation and return a
ProjectionJobHandle.Unlike
generate(), this method does not block on completion.- Parameters:
graph_name (str)
node_count (int)
average_degree (float)
relationship_distribution (str | None)
relationship_seed (int | None)
relationship_property (RelationshipPropertySpec | None)
orientation (str | None)
aggregation (str | None)
allow_self_loops (bool | None)
read_concurrency (int | None)
job_id (str | None)
sudo (bool)
log_progress (bool)
username (str | None)
overwrite (bool)
- 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 project: ProjectArrowEndpoints¶
Provides access to the project endpoints.
- 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.
- class graphdatascience.procedure_surface.arrow.catalog.GraphWithProjectResult¶
Result object for graph projection jobs, containing the projected graph and the projection result. Can be used as a context manager to ensure the projected graph is dropped after use.
- static __new__(_cls, graph: Graph, result: ProjectionResult | StoreProjectionResult)¶
Create new instance of GraphWithProjectResult(graph, result)
- Parameters:
graph (Graph)
result (ProjectionResult | StoreProjectionResult)
- result: ProjectionResult | StoreProjectionResult¶
Alias for field number 1
- class graphdatascience.procedure_surface.arrow.catalog.ProjectArrowEndpoints¶
Endpoints for projecting graphs via the Arrow pipeline.
- cypher(graph_name: str, query: str, *, query_parameters: dict[str, Any] | None = None, job_id: str | None = None, concurrency: int | None = None, undirected_relationship_types: List[str] | None = None, inverse_indexed_relationship_types: List[str] | None = None, batch_size: int | None = None, logging: bool = True, overwrite: bool = False) GraphWithProjectResult¶
Projects a graph from the Neo4j database into the GDS graph catalog using Cypher projection.
- Parameters:
graph_name (str) – Name of the graph to be created
query (str) – Cypher query to select nodes and relationships for the graph projection. Must contain gds.graph.project.remote. Example: MATCH (n)–>(m) RETURN gds.graph.project.remote(n, m)
query_parameters (dict[str, Any] | None) – Parameters that will be passed to the Cypher query.
job_id (str | None) – Identifier for the computation.
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 to index in both directions.
batch_size (int | None) – Number of rows to process in each batch when projecting the graph.
logging (bool) – Whether to log progress during graph projection.
overwrite (bool) – If True, drop an existing graph with the same name before projecting the new one. Defaults to False.
- Returns:
A result object containing information about the projected graph.
- Return type:
- cypher_async(graph_name: str, query: str, *, query_parameters: dict[str, Any] | None = None, job_id: str | None = None, concurrency: int | None = None, undirected_relationship_types: List[str] | None = None, inverse_indexed_relationship_types: List[str] | None = None, batch_size: int | None = None, overwrite: bool = False) ProjectionJobHandle¶
Kick off a cypher graph projection and return a
ProjectionJobHandle.Unlike
cypher(), this method does not block on completion. Use the returned handle to query status or retrieve the projected graph and result.- Parameters:
- Return type:
- native(graph_name: str, node_label_filter: List[str], relationship_type_filter: List[str], *, node_properties: List[str] | None = None, relationship_properties: List[str] | None = None, job_id: str | None = None, concurrency: int | None = None, undirected_relationship_types: List[str] | None = None, inverse_indexed_relationship_types: List[str] | None = None, batch_size: int | None = None, logging: bool = True, overwrite: bool = False) GraphWithProjectResult¶
Projects a graph from the Neo4j database into the GDS graph catalog.
- Parameters:
graph_name (str) – Name of the graph to be created
node_label_filter (List[str]) – List of node labels to include in the graph projection.
relationship_type_filter (List[str]) – List of relationship types to include in the graph projection.
node_properties (List[str] | None) – List of node properties to include in the graph projection.
relationship_properties (List[str] | None) – List of relationship properties to include in the graph projection.
job_id (str | None) – Identifier for the computation.
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 to index in both directions.
batch_size (int | None) – Number of rows to process in each batch when projecting the graph.
logging (bool) – Whether to log progress during graph projection.
overwrite (bool) – If True, drop an existing graph with the same name before projecting the new one. Defaults to False.
- Returns:
A result object containing information about the projected graph.
- Return type:
- native_async(graph_name: str, node_label_filter: List[str], relationship_type_filter: List[str], *, node_properties: List[str] | None = None, relationship_properties: List[str] | None = None, job_id: str | None = None, concurrency: int | None = None, undirected_relationship_types: List[str] | None = None, inverse_indexed_relationship_types: List[str] | None = None, batch_size: int | None = None, overwrite: bool = False) ProjectionJobHandle¶
Kick off a native graph projection and return a
ProjectionJobHandle.Unlike
native(), this method does not block on completion. The returned handle can be used to await completion and retrieve the projected graph and result.
- pydantic model graphdatascience.procedure_surface.arrow.catalog.ProjectionResult¶
Result object for graph projection jobs.