目录端点

enum graphdatascience.procedure_surface.api.catalog.Aggregation(value)
成员类型:

str

有效值如下:

NONE = <Aggregation.NONE: 'NONE'>
SINGLE = <Aggregation.SINGLE: 'SINGLE'>
SUM = <Aggregation.SUM: 'SUM'>
MIN = <Aggregation.MIN: 'MIN'>
MAX = <Aggregation.MAX: 'MAX'>
COUNT = <Aggregation.COUNT: 'COUNT'>

Enum 及其成员也拥有以下方法

__new__(value)
class graphdatascience.procedure_surface.api.catalog.CatalogEndpoints
abstract 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) GraphV2

从节点和关系数据帧(DataFrames)列表构建图。

参数:
  • graph_name (str) – 要构建的图的名称

  • nodes (DataFrame | list[DataFrame]) –

    节点数据帧。数据帧应遵循以下模式:

    • nodeId 用于在整个数据帧中唯一标识节点

    • labels 用于以字符串列表形式指定节点标签(可选)

    • 其他列被视为节点属性

  • relationships (DataFrame | list[DataFrame] | None) –

    关系数据帧。数据帧应遵循以下模式:

    • sourceNodeId 用于标识关系的起始节点

    • targetNodeId 用于标识关系的结束节点

    • relationshipType 用于指定关系类型(可选)

    • 其他列被视为关系属性

  • concurrency (int | None) – 要使用的并发线程数。

  • undirected_relationship_types (list[str] | None) – 要视为无向关系的关系类型列表。

返回:

构建的图对象。

返回类型:

GraphV2

property datasets: DatasetEndpoints

用于将预定义数据集加载到图目录中的端点。

abstract drop(G: GraphV2 | str, fail_if_missing: bool = True) GraphInfo | None

从图目录中删除一个图。

参数:
  • G (GraphV2 | str) – 要通过对象名称删除的图。

  • fail_if_missing (bool) – 若图缺失是否报错

返回:

包含节点计数等信息的 GraphV2 元数据对象。

返回类型:

GraphListResult

abstract filter(G: GraphV2, graph_name: str, node_filter: str, relationship_filter: str, concurrency: int | None = None, job_id: str | None = None) GraphWithFilterResult

基于过滤表达式创建图的子图。

参数:
  • G (GraphV2) – 要使用的图对象

  • (str) (relationship_filter) – 要创建的子图名称

  • (str) – 节点的过滤表达式

  • (str) – 关系的过滤表达式

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

  • graph_name (str)

  • node_filter (str)

  • relationship_filter (str)

返回:

包含过滤后的图对象以及图名称、节点数、关系数等信息的元组。

返回类型:

GraphWithFilterResult

abstract generate(graph_name: str, node_count: int, average_degree: float, *, relationship_distribution: str | None = None, relationship_seed: int | None = None, relationship_property: RelationshipPropertySpec | None = None, orientation: str | None = None, allow_self_loops: bool | None = None, read_concurrency: int | None = None, job_id: str | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None) GraphWithGenerationStats

生成一个随机图并将其存储在图目录中。

参数:
  • graph_name (str) – 生成的图的名称。

  • node_count (int) – 生成图中的节点数量

  • average_degree (float) – 生成节点的平均出度

  • relationship_distribution (str | None, default=None) – 确定关系分布策略。

  • relationship_seed (int | None, default=None) – 用于生成确定性关系的种子值。

  • relationship_property (RelationshipPropertySpec | None, 默认=None) – 配置生成的关联属性。

  • orientation (str | None, default=None) – 指定生成关系的方向。

  • allow_self_loops (bool | None, default=None) – 图中的节点是否可以具有起始节点和结束节点相同的关系。

  • read_concurrency (int | None, default=None) – 图生成期间使用的并发线程/进程数。

  • job_id (str | None) – 计算任务的标识符。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

返回:

包含生成的图对象和包含生成统计信息的结果对象的元组。

返回类型:

GraphGenerationStats

abstract get(graph_name: str) GraphV2

从图目录中检索图的句柄。

参数:

graph_name (str) – 图的名称。

返回:

该图的句柄。

返回类型:

GraphV2

abstract list(G: GraphV2 | str | None = None) list[GraphInfoWithDegrees]

列出图目录中的图。

参数:

G (GraphV2 | str | None) – 用于过滤结果的 GraphV2 对象或名称。如果为 None,则列出所有图。

返回:

包含节点计数等信息的图元数据对象列表。

返回类型:

list[GraphInfoWithDegrees]

abstract property node_labels: NodeLabelEndpoints

用于节点标签操作的端点。

abstract property node_properties: NodePropertiesEndpoints

用于节点标签操作的端点。

abstract property relationships: RelationshipsEndpoints

用于关系操作的端点。

abstract property sample: GraphSamplingEndpoints

用于图采样的端点。

class graphdatascience.procedure_surface.api.catalog.GraphBackend
pydantic 模型 graphdatascience.procedure_surface.api.catalog.GraphFilterResult
字段 from_graph_name: str
字段 graph_name: str
字段 node_count: int
字段 node_filter: str
字段 project_millis: int
字段 relationship_count: int
字段 relationship_filter: str
pydantic 模型 graphdatascience.procedure_surface.api.catalog.GraphGenerationStats
字段 average_degree: float
字段 generate_millis: int
字段 name: str
字段 nodes: int
字段 relationship_distribution: str
字段 relationship_property: RelationshipPropertySpec
字段 relationship_seed: int | None
字段 relationships: int
pydantic 模型 graphdatascience.procedure_surface.api.catalog.GraphInfo
验证器:
  • strip_timezone » creation_time

  • strip_timezone » modification_time

字段 configuration: dict[str, Any]
字段 creation_time: datetime
验证依据:
  • strip_timezone

字段 database: str
字段 database_location: str
字段 density: float
字段 graph_name: str
字段 graph_schema: dict[str, Any]
字段 memory_usage: str
字段 modification_time: datetime
验证依据:
  • strip_timezone

字段 node_count: int
字段 relationship_count: int
字段 size_in_bytes: int
validator strip_timezone  »  modification_time, creation_time
参数:

value (Any)

返回类型:

Any

pydantic 模型 graphdatascience.procedure_surface.api.catalog.GraphInfoWithDegrees
验证器:

字段 degree_distribution: dict[str, float | int]
class graphdatascience.procedure_surface.api.catalog.GraphSamplingEndpoints
abstract cnarw(G: GraphV2, graph_name: str, start_nodes: list[int] | None = None, restart_probability: float = 0.1, sampling_ratio: float = 0.15, node_label_stratification: bool = False, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) GraphWithSamplingResult

通用邻居感知随机游走 (CNARW) 通过从一组起始节点进行随机游走来对图进行采样。

CNARW 是一种图采样技术,涉及优化下一跳节点的选择。它考虑了当前节点和下一跳候选节点之间共同邻居的数量。在随机游走的每一步,都有一定概率停止游走,并从起始节点中的一个开始新的游走(即游走重新启动)。这些游走中访问的每个节点都将成为采样子图的一部分。生成的子图作为新图存储在图目录中。

参数:
  • G (GraphV2) – 要使用的图对象

  • graph_name (str) – 存储在图目录中的新图的名称。

  • start_nodes (list of int, 可选) –

    原始图中初始节点集合的 ID,采样随机游走将从这些节点开始。

    默认情况下,会随机均匀选择一个节点。

  • restart_probability (float, 可选) – 采样随机游走从起始节点之一重新启动的概率。默认为 0.1。

  • sampling_ratio (float, 可选) – 原始图中要采样的节点比例。默认为 0.15。

  • node_label_stratification (bool, 可选) – 如果为真,则保留原始图的节点标签分布。默认为 False。

  • relationship_weight_property (str | None) – 用作权重的属性名称。

  • relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

返回:

包含图对象和通用邻居感知随机游走 (CNARW) 结果的元组,包括采样图的维度。

返回类型:

GraphSamplingResult

abstract estimate(G: GraphV2, start_nodes: list[int] | None = None, restart_probability: float = 0.1, sampling_ratio: float = 0.15, node_label_stratification: bool = False, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult

估算 CNARW 算法运行的内存消耗。

参数:
  • G (GraphV2) – 要使用的图对象

  • start_nodes (list of int, 可选) – 原始图中初始节点集合的 ID,采样随机游走将从这些节点开始。默认情况下,会随机均匀选择一个节点。

  • restart_probability (float, 可选) – 采样随机游走从起始节点之一重新启动的概率。默认为 0.1。

  • sampling_ratio (float, 可选) – 原始图中要采样的节点比例。默认为 0.15。

  • node_label_stratification (bool, 可选) – 如果为真,则保留原始图的节点标签分布。默认为 False。

  • relationship_weight_property (str | None) – 用作权重的属性名称。

  • relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • concurrency (int | None) – 要使用的并发线程数。

返回:

内存预估详情

返回类型:

EstimationResult

abstract rwr(G: GraphV2, graph_name: str, start_nodes: list[int] | None = None, restart_probability: float = 0.1, sampling_ratio: float = 0.15, node_label_stratification: bool = False, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) GraphWithSamplingResult

带重启的随机游走 (RWR) 通过从一组起始节点进行随机游走来对图进行采样。

在随机游走的每一步,都有一定概率停止游走,并从起始节点中的一个开始新的游走(即游走重新启动)。这些游走中访问的每个节点都将成为采样子图的一部分。生成的子图作为新图存储在图目录中。

参数:
  • G (GraphV2) – 要使用的图对象

  • graph_name (str) – 存储在图目录中的新图的名称。

  • start_nodes (list of int, 可选) – 原始图中初始节点集合的 ID,采样随机游走将从这些节点开始。默认情况下,会随机均匀选择一个节点。

  • restart_probability (float, 可选) – 采样随机游走从起始节点之一重新启动的概率。默认为 0.1。

  • sampling_ratio (float, 可选) – 原始图中要采样的节点比例。默认为 0.15。

  • node_label_stratification (bool, 可选) – 如果为真,则保留原始图的节点标签分布。默认为 False。

  • relationship_weight_property (str | None) – 用作权重的属性名称。

  • relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

返回:

包含图对象和带重启随机游走 (RWR) 结果的元组,包括采样图的维度。

返回类型:

GraphWithSamplingResult

pydantic 模型 graphdatascience.procedure_surface.api.catalog.GraphSamplingResult
字段 from_graph_name: str
字段 graph_name: str
字段 node_count: int
字段 project_millis: int
字段 relationship_count: int
字段 start_node_count: int
class graphdatascience.procedure_surface.api.catalog.GraphWithFilterResult

GraphWithFilterResult(graph, result)

static __new__(_cls, graph: GraphV2, result: GraphFilterResult)

创建 GraphWithFilterResult(graph, result) 的新实例

参数:
graph: GraphV2

字段编号 0 的别名

result: GraphFilterResult

字段编号 1 的别名

class graphdatascience.procedure_surface.api.catalog.GraphWithGenerationStats

GraphWithGenerationStats(graph, result)

static __new__(_cls, graph: GraphV2, result: GraphGenerationStats)

创建 GraphWithGenerationStats(graph, result) 的新实例

参数:
graph: GraphV2

字段编号 0 的别名

result: GraphGenerationStats

字段编号 1 的别名

class graphdatascience.procedure_surface.api.catalog.GraphWithSamplingResult

GraphWithSamplingResult(graph, result)

static __new__(_cls, graph: GraphV2, result: GraphSamplingResult)

创建 GraphWithSamplingResult(graph, result) 的新实例

参数:
graph: GraphV2

字段编号 0 的别名

result: GraphSamplingResult

字段编号 1 的别名

class graphdatascience.procedure_surface.api.catalog.NodeLabelEndpoints
abstract mutate(G: GraphV2, node_label: str, *, node_filter: str, sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, write_concurrency: int | None = None, job_id: str | None = None) NodeLabelMutateResult

将指定的节点标签附加到图中经过筛选的节点上。

参数:
  • G (GraphV2) – 要使用的图对象

  • node_label (str) – 要回写的节点标签。

  • node_filter (str) – 用于筛选输入图中节点的 Cypher 谓词。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • write_concurrency (int | None) – 用于写入的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

返回:

执行指标和统计信息

返回类型:

NodeLabelMutateResult

abstract write(G: GraphV2, node_label: str, *, node_filter: str, sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, write_concurrency: int | None = None, job_id: str | None = None) NodeLabelWriteResult

将指定的节点标签写入数据库中经过筛选的节点。

参数:
  • G (GraphV2) – 要使用的图对象

  • node_label (str) – 要回写的节点标签。

  • node_filter (str) – 用于筛选输入图中节点的 Cypher 谓词。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • write_concurrency (int | None) – 用于写入的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

返回:

执行指标和统计信息

返回类型:

NodeLabelWriteResult

pydantic model graphdatascience.procedure_surface.api.catalog.NodeLabelMutateResult
field mutate_millis: int
pydantic model graphdatascience.procedure_surface.api.catalog.NodeLabelPersistenceResult
field configuration: dict[str, object]
field graph_name: str
field node_count: int
field node_label: str
field node_labels_written: int
pydantic model graphdatascience.procedure_surface.api.catalog.NodeLabelWriteResult
field write_millis: int
pydantic model graphdatascience.procedure_surface.api.catalog.NodePropertiesDropResult
field graph_name: str
field node_properties: list[str]
field properties_removed: int
class graphdatascience.procedure_surface.api.catalog.NodePropertiesEndpoints
abstract drop(G: GraphV2, node_properties: list[str], *, fail_if_missing: bool | None = None, concurrency: int | None = None, username: str | None = None) NodePropertiesDropResult

从图中删除指定的节点属性。

参数:
  • G (GraphV2) – 要使用的图对象

  • node_properties (list[str]) – 要删除的节点属性

  • fail_if_missing (bool | None = None,) – 如果缺少任何节点属性,是否失败

  • concurrency (int | None) – 要使用的并发线程数。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

返回:

执行指标和统计信息

返回类型:

NodePropertiesDropResult

abstract stream(G: GraphV2, node_properties: str | list[str], *, list_node_labels: bool | None = None, node_labels: list[str] = ['*'], concurrency: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, job_id: str | None = None, db_node_properties: list[str] | None = None) DataFrame

以流式传输从图中提取指定的节点属性。

参数:
  • G (GraphV2) – 要使用的图对象

  • node_properties (str | list[str]) – 要流式传输的节点属性

  • list_node_labels (boolean | None, default=None) – 是否在流中包含节点标签

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • concurrency (int | None) – 要使用的并发线程数。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • job_id (str | None) – 计算任务的标识符。

  • db_node_properties (list[str] | None, default=None) – 从数据库检索额外的节点属性并将其附加到流中。

返回:

流式传输的节点属性

返回类型:

DataFrame

abstract write(G: GraphV2, node_properties: str | list[str] | dict[str, str], *, node_labels: list[str] = ['*'], concurrency: int | None = None, write_concurrency: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, job_id: str | None = None) NodePropertiesWriteResult

将图中指定的节点属性写入数据库。

参数:
  • G (GraphV2) – 要使用的图对象

  • node_properties (str | list[str] | dict[str, str]) –

    要写入的节点属性。可以是:

    • 表示单个属性名称的字符串。

    • 表示多个属性名称的字符串列表。

    • 将 GDS 图中的属性名称映射到数据库中属性名称的字典。

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • concurrency (int | None) – 要使用的并发线程数。

  • write_concurrency (int | None) – 用于写入的并发线程数。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • job_id (str | None) – 计算任务的标识符。

返回:

执行指标和统计信息

返回类型:

NodePropertiesWriteResult

pydantic model graphdatascience.procedure_surface.api.catalog.NodePropertiesWriteResult
field configuration: dict[str, Any]
field graph_name: str
field node_properties: list[str]
field properties_written: int
field write_millis: int
class graphdatascience.procedure_surface.api.catalog.NodePropertySpec

NodePropertySpec(node_properties: ‘str | list[str] | dict[str, str]’) -> ‘None’

pydantic model graphdatascience.procedure_surface.api.catalog.RelationshipPropertySpec
field max: float | None
field min: float | None
field name: str
field type: str
field value: float | None
static fixed(name: str, value: float) RelationshipPropertySpec
参数:
返回类型:

RelationshipPropertySpec

static random(name: str, min: float, max: float) RelationshipPropertySpec
参数:
返回类型:

RelationshipPropertySpec

pydantic model graphdatascience.procedure_surface.api.catalog.RelationshipsDropResult
field deleted_properties: dict[str, int]
field deleted_relationships: int
field graph_name: str
field relationship_type: str
class graphdatascience.procedure_surface.api.catalog.RelationshipsEndpoints
abstract collapse_path(G: GraphV2, path_templates: list[list[str]], mutate_relationship_type: str, *, allow_self_loops: bool = False, concurrency: int | None = None, job_id: str | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None) CollapsePathResult

将图中每条现有的路径折叠成一条关系。

参数:
  • G (GraphV2) – 要使用的图对象

  • path_templates (list[list[str]]) – 路径模板是用于遍历的有序关系类型列表。同一关系类型可以多次添加,以便按指示进行遍历。此外,您可以指定多个路径模板以便一次性处理。

  • mutate_relationship_type (str) – 用于存储结果的关系类型名称。

  • allow_self_loops (bool, default=False) – 图中的节点是否可以具有起始节点和结束节点相同的关系。

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

返回:

CollapsePathResult

返回类型:

关于生成关系的元数据。

abstract drop(G: GraphV2, relationship_type: str, *, fail_if_missing: bool = True) RelationshipsDropResult

从图中删除指定关系类型的所有关系,包括其所有属性。

参数:
  • G (GraphV2) – 要使用的图对象

  • relationship_type (str) – 要删除的关系类型

  • fail_if_missing (bool, default=True) – 如果设置为 true,当图中不存在该关系类型时,过程将失败。

返回:

执行指标和统计信息

返回类型:

RelationshipsDropResult

abstract index_inverse(G: GraphV2, relationship_types: list[str], *, concurrency: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, job_id: str | None = None) RelationshipsInverseIndexResult

为指定的关系创建索引,索引每个关系的相反方向。某些算法可以使用此索引来加速计算。

参数:
  • G (GraphV2) – 要使用的图对象

  • relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。

  • concurrency (int | None) – 要使用的并发线程数。

  • sudo (bool = False,) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • job_id (str | None) – 计算任务的标识符。

返回:

执行指标和统计信息

返回类型:

RelationshipsInverseIndexResult

abstract stream(G: GraphV2, relationship_types: list[str] = ['*'], relationship_properties: list[str] | None = None, *, concurrency: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None) DataFrame

以流式传输指定类型和属性的所有关系。

参数:
  • G (GraphV2) – 要使用的图对象

  • relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。

  • relationship_properties (list[str] | None, default = None) – 要流式传输的关系属性。如果未指定,将不流式传输任何属性。

  • concurrency (int | None) – 要使用的并发线程数。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

返回:

流式传输的关系 [sourceId, targetId, relationshipType],每个属性对应一列

返回类型:

DataFrame

abstract to_undirected(G: GraphV2, relationship_type: str, mutate_relationship_type: str, *, aggregation: Aggregation | dict[str, Aggregation] | None = None, concurrency: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, job_id: str | None = None) RelationshipsToUndirectedResult

在图中创建一种新的关系类型。该关系将基于现有的关系类型,但关系将作为无向关系存储。

参数:
  • G (GraphV2) – 要使用的图对象

  • relationship_type (str,) – 输入关系类型

  • mutate_relationship_type (str,) – 用于存储结果的关系类型的名称。

  • aggregation (Aggregation | dict[str, Aggregation] | None = None,) – 指定如何在图中聚合平行关系。如果提供了单个聚合方式,它将用于指定关系的所有属性。可以提供一个字典来指定特定属性的聚合方式。

  • concurrency (int | None) – 要使用的并发线程数。

  • sudo (bool = False,) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • job_id (str | None) – 计算任务的标识符。

返回:

执行指标和统计信息

返回类型:

RelationshipsInverseIndexResult

abstract write(G: GraphV2, relationship_type: str, relationship_properties: list[str] | None = None, *, concurrency: int | None = None, write_concurrency: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, job_id: str | None = None) RelationshipsWriteResult

将图中指定关系类型及属性的所有关系写入数据库。

参数:
  • G (GraphV2) – 要使用的图对象

  • relationship_type (str) – 要写入数据库的关系类型

  • relationship_properties (list[str] | None, default = None) – 要写入的关系属性。如果未指定,则不会写入任何属性。

  • concurrency (int | None) – 要使用的并发线程数。

  • write_concurrency (int | None) – 用于写入的并发线程数。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • job_id (str | None) – 计算任务的标识符。

返回:

执行指标和统计信息

返回类型:

RelationshipsWriteResult

pydantic 模型 graphdatascience.procedure_surface.api.catalog.RelationshipsInverseIndexResult
字段 compute_millis: int
字段 configuration: dict[str, Any]
字段 input_relationships: int
字段 mutate_millis: int
字段 post_processing_millis: int
字段 pre_processing_millis: int
pydantic 模型 graphdatascience.procedure_surface.api.catalog.RelationshipsToUndirectedResult
字段 relationships_written: int
pydantic 模型 graphdatascience.procedure_surface.api.catalog.RelationshipsWriteResult
验证器:
  • coerce_relationship_properties » relationship_properties

字段 configuration: dict[str, Any]
字段 graph_name: str
字段 properties_written: int
字段 relationship_properties: list[str]
验证依据:
  • coerce_relationship_properties

字段 relationship_type: str
字段 relationships_written: int
字段 write_millis: int
校验器 coerce_relationship_properties  »  relationship_properties
参数:

v (Any)

返回类型:

list[str]

graphdatascience.procedure_surface.api.catalog.ScalePropertiesEndpoints
abstract estimate(G: GraphV2 | dict[str, Any], node_properties: list[str], scaler: str | dict[str, str | int | float] | ScalerConfig, node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult

预估算法运行的内存消耗。

参数:
  • G (GraphV2 | dict[str, Any]) – 要使用的图对象,或表示图维度的字典。

  • node_properties (Any) – 要缩放的节点属性。可以是属性名称列表,也可以是将属性名称映射到配置的字典。

  • scaler (str | dict[str, str | int | float] | ScalerConfig) –

    要使用的缩放器。可以是

    • 字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)

    • 包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • concurrency (int | None) – 要使用的并发线程数。

返回:

内存预估详情

返回类型:

EstimationResult

abstract mutate(G: GraphV2, mutate_property: str, node_properties: list[str], scaler: str | dict[str, str | int | float] | ScalerConfig, node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) ScalePropertiesMutateResult

运行“缩放属性”(Scale Properties)算法,并将结果作为新的节点属性存储在图目录中。

“缩放属性”算法使用指定的缩放器(例如:MinMax、Mean、Max、Log、StdScore、Center)对节点属性进行缩放。

参数:
  • G (GraphV2) – 要使用的图对象

  • mutate_property (str) – 用于存储结果的节点属性名称。

  • node_properties (list[str]) – 要缩放的节点属性。可以是属性名称列表,也可以是将属性名称映射到配置的字典。

  • scaler (str | dict[str, str | int | float] | ScalerConfig) –

    要使用的缩放器。可以是

    • 字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)

    • 包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

返回:

算法指标和统计信息,包括缩放器统计信息

返回类型:

ScalePropertiesMutateResult

abstract stats(G: GraphV2, node_properties: list[str], scaler: str | dict[str, str | int | float] | ScalerConfig, node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) ScalePropertiesStatsResult

运行“缩放属性”算法并返回结果统计信息,而不存储结果。

“缩放属性”算法使用指定的缩放器(例如:MinMax、Mean、Max、Log、StdScore、Center)对节点属性进行缩放。

参数:
  • G (GraphV2) – 要使用的图对象

  • node_properties (list[str]) – 要缩放的节点属性。可以是属性名称列表,也可以是将属性名称映射到配置的字典。

  • scaler (str | dict[str, str | int | float] | ScalerConfig) –

    要使用的缩放器。可以是

    • 字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)

    • 包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

返回:

算法统计信息,包括缩放器统计信息

返回类型:

ScalePropertiesStatsResult

abstract stream(G: GraphV2, node_properties: list[str], scaler: str | dict[str, str | int | float] | ScalerConfig, node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) DataFrame

执行“缩放属性”算法并返回结果流。

参数:
  • G (GraphV2) – 要使用的图对象

  • node_properties (list[str]) – 要缩放的节点属性。可以是属性名称列表,也可以是将属性名称映射到配置的字典。

  • scaler (str | dict[str, str | int | float] | ScalerConfig) –

    要使用的缩放器。可以是

    • 字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)

    • 包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

返回:

包含 nodeId 和 scaledProperty 列的 DataFrame,其中包含缩放后的属性值。每一行代表一个带有相应缩放属性值的节点。

返回类型:

DataFrame

abstract write(G: GraphV2, write_property: str, node_properties: list[str], scaler: str | dict[str, str | int | float] | ScalerConfig, node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, write_concurrency: int | None = None) ScalePropertiesWriteResult

运行“缩放属性”算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。

“缩放属性”算法使用指定的缩放器(例如:MinMax、Mean、Max、Log、StdScore、Center)对节点属性进行缩放。

参数:
  • G (GraphV2) – 要使用的图对象

  • write_property (str) – 用于存储结果的节点属性名称。

  • node_properties (list[str]) – 要缩放的节点属性。可以是属性名称列表,也可以是将属性名称映射到配置的字典。

  • scaler (str | dict[str, str | int | float] | ScalerConfig) –

    要使用的缩放器。可以是

    • 字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)

    • 包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})

  • node_labels (list[str]) – 使用给定的节点标签过滤图。将包含具有任何给定标签的节点。

  • sudo (bool) – 禁用内存保护。

  • log_progress (bool) – 显示进度日志。

  • username (str | None) – 作为管理员,模拟其他用户以访问其图。

  • concurrency (int | None) – 要使用的并发线程数。

  • job_id (str | None) – 计算任务的标识符。

  • write_concurrency (int | None) – 用于写入的并发线程数。返回

  • -------

  • ScalePropertiesWriteResult – 算法指标和统计信息,包括缩放器统计信息和写入耗时

返回类型:

ScalePropertiesWriteResult

pydantic 模型 graphdatascience.procedure_surface.api.catalog.ScalePropertiesMutateResult

以 mutate 模式运行“缩放属性”算法的结果。

字段 compute_millis: int
字段 configuration: dict[str, Any]
字段 mutate_millis: int
字段 node_properties_written: int
字段 post_processing_millis: int
字段 pre_processing_millis: int
字段 scaler_statistics: dict[str, Any]
pydantic 模型 graphdatascience.procedure_surface.api.catalog.ScalePropertiesStatsResult

以 stats 模式运行“缩放属性”算法的结果。

字段 compute_millis: int
字段 configuration: dict[str, Any]
字段 post_processing_millis: int
字段 pre_processing_millis: int
字段 scaler_statistics: dict[str, Any]
pydantic 模型 graphdatascience.procedure_surface.api.catalog.ScalePropertiesWriteResult

以 write 模式运行“缩放属性”算法的结果。

字段 compute_millis: int
字段 configuration: dict[str, Any]
字段 node_properties_written: int
字段 post_processing_millis: int
字段 pre_processing_millis: int
字段 scaler_statistics: dict[str, Any]
字段 write_millis: int
pydantic 模型 graphdatascience.procedure_surface.api.catalog.ScalerConfig
字段 offset: int | float | None

在应用对数变换前添加到属性值的偏移量。仅当 type 为 ‘Log’ 时使用。

字段 type: str

要使用的缩放器类型。可以是 ‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’。

graphdatascience.graph.v2.graph_api.GraphV2

表示图目录中图的图对象。它可以传递给算法端点以在相应的图上进行计算。它包含有关该图的摘要信息。

configuration() dict[str, Any]
返回:

图的配置

返回类型:

dict[str, Any]

creation_time() datetime
返回:

图的创建时间

返回类型:

datetime

degree_distribution() dict[str, float | int]
返回:

图的度分布

返回类型:

dict[str, float | int]

density() float
返回:

图的密度

返回类型:

float

drop(failIfMissing: bool = True) GraphInfo | None
参数:

failIfMissing (bool) – 如果图不存在,是否报错

返回:

删除操作的结果

返回类型:

GraphInfo | None

exists() bool
返回:

图是否存在

返回类型:

bool

memory_usage() str
返回:

图的内存使用情况

返回类型:

str

modification_time() datetime
返回:

图的修改时间

返回类型:

datetime

name() str
返回:

图的名称

返回类型:

str

node_count() int
返回:

图中节点的数量

返回类型:

int

node_labels() list[str]
返回:

图中的节点标签

返回类型:

list[str]

node_properties() dict[str, list[str]]
返回:

每个节点标签对应的节点属性

返回类型:

dict[str, list[str]]

relationship_count() int
返回:

图中关系的数量

返回类型:

int

relationship_properties() dict[str, list[str]]
返回:

每个关系类型对应的关系属性

返回类型:

dict[str, list[str]]

relationship_types() list[str]
返回:

图中的关系类型

返回类型:

list[str]

size_in_bytes() int
返回:

图的大小(以字节为单位)

返回类型:

int

© . This site is unofficial and not affiliated with Neo4j, Inc.