中心性算法¶
- class graphdatascience.procedure_surface.api.centrality.ArticleRankEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], *, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = 'NONE', relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) EstimationResult¶
预估算法运行的内存消耗。
- 参数:
damping_factor (float) – 阻尼系数,用于控制跳转到随机节点的概率
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
concurrency (int | None) – 要使用的并发线程数。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起点的节点 ID。可以是:- 单个节点 ID(例如 42) - 节点 ID 列表(例如 [42, 43, 44]) - 节点与偏差 > 0 的关联元组列表(例如 [(42, 0.5), (43, 1.0)])
- 返回:
内存预估详情
- 返回类型:
- abstract mutate(G: GraphV2, mutate_property: str, *, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) ArticleRankMutateResult¶
运行 Article Rank 算法,并将结果作为新的节点属性存储在图目录中。
ArticleRank 是 Page Rank 算法的一种变体,用于衡量节点的传递影响力。Page Rank 遵循一个假设,即源自低度节点的连接比源自高度节点的连接具有更高的影响力。Article Rank 通过在每次迭代中降低发送给邻居的得分,从而降低低度节点的影响力。
- 参数:
G (GraphV2) – 要使用的图对象
mutate_property (str) – 用于存储结果的节点属性名称。
damping_factor (float) – 跳转到随机节点的概率。
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起点的节点 ID。可以是:- 单个节点 ID(例如 42) - 节点 ID 列表(例如 [42, 43, 44]) - 节点与偏差 > 0 的关联元组列表(例如 [(42, 0.5), (43, 1.0)])
- 返回:
算法指标和统计信息
- 返回类型:
- abstract stats(G: GraphV2, *, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) ArticleRankStatsResult¶
运行 Article Rank 算法并返回结果统计信息,而不存储结果。
ArticleRank 是 Page Rank 算法的一种变体,用于衡量节点的传递影响力。Page Rank 遵循一个假设,即源自低度节点的连接比源自高度节点的连接具有更高的影响力。Article Rank 通过在每次迭代中降低发送给邻居的得分,从而降低低度节点的影响力。
- 参数:
G (GraphV2) – 要使用的图对象
damping_factor (float) – 跳转到随机节点的概率。
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起点的节点 ID。可以是:- 单个节点 ID(例如 42) - 节点 ID 列表(例如 [42, 43, 44]) - 节点与偏差 > 0 的关联元组列表(例如 [(42, 0.5), (43, 1.0)])
- 返回:
算法统计信息
- 返回类型:
- abstract stream(G: GraphV2, *, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) DataFrame¶
执行 ArticleRank 算法并将结果以流的形式返回。
- 参数:
G (GraphV2) – 要使用的图对象
damping_factor (float) – 阻尼系数,用于控制跳转到随机节点的概率
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起点的节点 ID。可以是:- 单个节点 ID(例如 42) - 节点 ID 列表(例如 [42, 43, 44]) - 节点与偏差 > 0 的关联元组列表(例如 [(42, 0.5), (43, 1.0)])
- 返回:
包含节点 ID 及其 ArticleRank 得分的 DataFrame
- 返回类型:
DataFrame
- abstract write(G: GraphV2, write_property: str, *, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None, write_concurrency: int | None = None) ArticleRankWriteResult¶
运行 Article Rank 算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。
ArticleRank 是 Page Rank 算法的一种变体,用于衡量节点的传递影响力。Page Rank 遵循一个假设,即源自低度节点的连接比源自高度节点的连接具有更高的影响力。Article Rank 通过在每次迭代中降低发送给邻居的得分,从而降低低度节点的影响力。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
damping_factor (float) – 跳转到随机节点的概率。
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起点的节点 ID。可以是:- 单个节点 ID(例如 42) - 节点 ID 列表(例如 [42, 43, 44]) - 节点与偏差 > 0 的关联元组列表(例如 [(42, 0.5), (43, 1.0)])
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
ArticleRankWriteResult – 算法指标和统计信息
- 返回类型:
- pydantic model graphdatascience.procedure_surface.api.centrality.ArticleRankMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.centrality.ArticleRankStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.centrality.ArticleRankWriteResult¶
- class graphdatascience.procedure_surface.api.centrality.ArticulationPointsEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult¶
预估算法运行的内存消耗。
- abstract mutate(G: GraphV2, mutate_property: str, 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) ArticulationPointsMutateResult¶
运行“关节点”(Articulation Points)算法,并将结果作为新的节点属性存储在图目录中。
在给定图中,关节点(或称割点)是指当其被移除后会导致图中连通分量数量增加的节点。
- 参数:
- 返回:
算法指标和统计信息,包括找到的关节点计数
- 返回类型:
- abstract stats(G: GraphV2, 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) ArticulationPointsStatsResult¶
运行“关节点”算法并返回结果统计信息,而不存储结果。
在给定图中,关节点(或称割点)是指当其被移除后会导致图中连通分量数量增加的节点。
- abstract stream(G: GraphV2, 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) DataFrame¶
执行“关节点”算法并以数据流形式返回结果。
- 参数:
- 返回:
包含关节点的 DataFrame,包含以下列:- nodeId:关节点的 ID - resultingComponents:关于结果连通分量的信息
- 返回类型:
DataFrame
- abstract write(G: GraphV2, write_property: str, 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, write_concurrency: int | None = None) ArticulationPointsWriteResult¶
运行“关节点”算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。
在给定图中,关节点(或称割点)是指当其被移除后会导致图中连通分量数量增加的节点。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
ArticulationPointsWriteResult – 算法指标和统计信息,包括找到的关节点计数
- 返回类型:
- pydantic model graphdatascience.procedure_surface.api.centrality.ArticulationPointsMutateResult¶
以 mutate(变异)模式运行“关节点”算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.ArticulationPointsStatsResult¶
以 stats(统计)模式运行“关节点”算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.ArticulationPointsWriteResult¶
以 write(写入)模式运行“关节点”算法的结果。
- class graphdatascience.procedure_surface.api.centrality.BetweennessEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], sampling_size: int | None = None, sampling_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None, relationship_weight_property: str | None = None) EstimationResult¶
预估算法运行的内存消耗。
- abstract mutate(G: GraphV2, mutate_property: str, sampling_size: int | None = None, sampling_seed: int | 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, relationship_weight_property: str | None = None) BetweennessMutateResult¶
运行“介数中心性”(Betweenness Centrality)算法,并将结果作为新的节点属性存储在图目录中。
介数中心性是一种检测节点对图中信息流影响程度的方法。它通常用于寻找在图的不同部分之间充当桥梁的节点。该算法计算图中所有节点对之间的最短路径。每个节点都会根据通过该节点的最短路径数量获得一个分数。
- 参数:
G (GraphV2) – 要使用的图对象
mutate_property (str) – 用于存储结果的节点属性名称。
sampling_size (int | None, 默认=None) – 计算中心性分数时需要考虑的源节点数量。
sampling_seed (int | None, 默认=None) – 用于选择源节点的随机数生成器的种子值。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
- 返回:
算法指标和统计信息,包括中心性分布
- 返回类型:
- abstract stats(G: GraphV2, sampling_size: int | None = None, sampling_seed: int | 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, relationship_weight_property: str | None = None) BetweennessStatsResult¶
运行“介数中心性”算法并返回结果统计信息,而不存储结果。
介数中心性是一种检测节点对图中信息流影响程度的方法。它通常用于寻找在图的不同部分之间充当桥梁的节点。该算法计算图中所有节点对之间的最短路径。每个节点都会根据通过该节点的最短路径数量获得一个分数。
- 参数:
G (GraphV2) – 要使用的图对象
sampling_size (int | None, 默认=None) – 计算中心性分数时需要考虑的源节点数量。
sampling_seed (int | None, 默认=None) – 用于选择源节点的随机数生成器的种子值。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
- 返回:
算法统计信息,包括中心性分布
- 返回类型:
- abstract stream(G: GraphV2, sampling_size: int | None = None, sampling_seed: int | 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, relationship_weight_property: str | None = None) DataFrame¶
执行“介数中心性”算法并以数据流形式返回结果。
- 参数:
G (GraphV2) – 要使用的图对象
sampling_size (int | None, 默认=None) – 用于采样的节点数量。
sampling_seed (int | None, 默认=None) – 采样随机化的种子值
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
- 返回:
包含 nodeId 和 score 列的 DataFrame,其中包含介数中心性结果
- 返回类型:
DataFrame
- abstract write(G: GraphV2, write_property: str, sampling_size: int | None = None, sampling_seed: int | 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, relationship_weight_property: str | None = None, write_concurrency: int | None = None) BetweennessWriteResult¶
运行“介数中心性”算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。
介数中心性是一种检测节点对图中信息流影响程度的方法。它通常用于寻找在图的不同部分之间充当桥梁的节点。该算法计算图中所有节点对之间的最短路径。每个节点都会根据通过该节点的最短路径数量获得一个分数。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
sampling_size (int | None, 默认=None) – 计算中心性分数时需要考虑的源节点数量。
sampling_seed (int | None, 默认=None) – 用于选择源节点的随机数生成器的种子值。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
BetweennessWriteResult – 算法指标和统计信息,包括中心性分布
- 返回类型:
- pydantic model graphdatascience.procedure_surface.api.centrality.BetweennessMutateResult¶
以 mutate(变异)模式运行“介数中心性”算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.BetweennessStatsResult¶
以 stats(统计)模式运行“介数中心性”算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.BetweennessWriteResult¶
以写入模式运行中介中心性(Betweenness Centrality)算法的结果。
- class graphdatascience.procedure_surface.api.centrality.BridgesEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult¶
预估算法运行的内存消耗。
- abstract stream(G: GraphV2, 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) DataFrame¶
执行 Bridges 算法并返回结果流。
- 参数:
- 返回:
包含‘from’(起始)、‘to’(目标)和‘remainingSizes’(剩余大小)列的 DataFrame。remainingSizes 列包含移除桥接关系后剩余连通分量的大小。
- 返回类型:
DataFrame
- class graphdatascience.procedure_surface.api.centrality.CelfEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], seed_set_size: int, propagation_probability: float = 0.1, monte_carlo_simulations: int = 100, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult¶
预估算法运行的内存消耗。
- 参数:
- 返回:
包含估计结果(包括内存需求)的对象
- 返回类型:
- abstract mutate(G: GraphV2, seed_set_size: int, mutate_property: str, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], monte_carlo_simulations: int = 100, propagation_probability: float = 0.1, random_seed: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) CelfMutateResult¶
运行 CELF 算法并将结果存储在图目录中作为新的节点属性。
影响最大化问题旨在寻找一组 k 个节点,以最大化网络中预期的影响传播。
- 参数:
G (GraphV2) – 要使用的图对象
seed_set_size (int) – 选作影响最大化种子集的节点数量
mutate_property (str) – 用于存储结果的节点属性名称。
propagation_probability (float | None, default=None) – 节点被其活跃邻居节点激活的概率。
monte_carlo_simulations (int | None, default=None) – 蒙特卡洛模拟次数。
random_seed (int | None) – 随机数生成的种子,以确保结果的可复现性。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
算法度量和统计信息,包括总影响传播
- 返回类型:
- abstract stats(G: GraphV2, seed_set_size: int, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], monte_carlo_simulations: int = 100, propagation_probability: float = 0.1, random_seed: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) CelfStatsResult¶
运行 CELF 算法并返回结果统计信息,而不存储结果。
影响最大化问题旨在寻找一组 k 个节点,以最大化网络中预期的影响传播。
- 参数:
G (GraphV2) – 要使用的图对象
seed_set_size (int) – 选作影响最大化种子集的节点数量
propagation_probability (float | None, default=None) – 节点被其活跃邻居节点激活的概率。
monte_carlo_simulations (int | None, default=None) – 蒙特卡洛模拟次数。
random_seed (int | None) – 随机数生成的种子,以确保结果的可复现性。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
算法统计信息,包括总影响传播
- 返回类型:
- abstract stream(G: GraphV2, seed_set_size: int, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], monte_carlo_simulations: int = 100, propagation_probability: float = 0.1, random_seed: int | None = None, sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None) DataFrame¶
执行 CELF 算法并返回结果流。
- 参数:
G (GraphV2) – 要使用的图对象
seed_set_size (int) – 选作影响最大化种子集的节点数量
propagation_probability (float | None, default=None) – 影响从一个节点传播到另一个节点的概率。
monte_carlo_simulations (int | None, default=None) – 蒙特卡洛模拟次数。
random_seed (int | None) – 随机数生成的种子,以确保结果的可复现性。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
包含 nodeId 和 spread 列的 DataFrame,包含 CELF 结果。每一行代表一个选定的节点及其相应的影响传播值。
- 返回类型:
DataFrame
- abstract write(G: GraphV2, seed_set_size: int, write_property: str, propagation_probability: float = 0.1, monte_carlo_simulations: int = 100, random_seed: int | 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, write_concurrency: int | None = None) CelfWriteResult¶
运行 CELF 算法并将结果存储在 Neo4j 数据库中作为新的节点属性。
影响最大化问题旨在寻找一组 k 个节点,以最大化网络中预期的影响传播。
- 参数:
G (GraphV2) – 要使用的图对象
seed_set_size (int) – 选作影响最大化种子集的节点数量
write_property (str) – 用于存储结果的节点属性名称。
propagation_probability (float | None, default=None) – 节点被其活跃邻居节点激活的概率。
monte_carlo_simulations (int | None, default=None) – 蒙特卡洛模拟次数。
random_seed (int | None) – 随机数生成的种子,以确保结果的可复现性。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
CelfWriteResult – 算法度量和统计信息,包括总影响传播和写入时间
- 返回类型:
- pydantic model graphdatascience.procedure_surface.api.centrality.CelfMutateResult¶
以变更(mutate)模式运行 CELF 算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.CelfStatsResult¶
以统计模式运行 CELF 算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.CelfWriteResult¶
以写入模式运行 CELF 算法的结果。
- class graphdatascience.procedure_surface.api.centrality.ClosenessEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], use_wasserman_faust: bool = False, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult¶
预估算法运行的内存消耗。
- 参数:
- 返回:
包含估算结果的对象
- 返回类型:
- abstract mutate(G: GraphV2, mutate_property: str, use_wasserman_faust: bool = False, 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) ClosenessMutateResult¶
运行紧密度中心性(Closeness Centrality)算法并将结果存储在图目录中作为新的节点属性。
紧密度中心性是一种检测能够非常有效地在图中传播信息的节点的方法。节点的紧密度中心性衡量其到所有其他节点的平均远度(距离的倒数)。具有高紧密度分数的节点到所有其他节点的距离最短。
- 参数:
G (GraphV2) – 要使用的图对象
mutate_property (str) – 用于存储结果的节点属性名称。
use_wasserman_faust (bool) – 使用改进的 Wasserman-Faust 公式进行紧密度计算。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
算法度量和统计信息,包括中心性分布
- 返回类型:
- abstract stats(G: GraphV2, use_wasserman_faust: bool = False, 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) ClosenessStatsResult¶
运行紧密度中心性算法并返回结果统计信息,而不存储结果。
紧密度中心性是一种检测能够非常有效地在图中传播信息的节点的方法。节点的紧密度中心性衡量其到所有其他节点的平均远度(距离的倒数)。具有高紧密度分数的节点到所有其他节点的距离最短。
- 参数:
G (GraphV2) – 要使用的图对象
use_wasserman_faust (bool) – 使用改进的 Wasserman-Faust 公式进行紧密度计算。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
算法统计信息,包括中心性分布
- 返回类型:
- abstract stream(G: GraphV2, use_wasserman_faust: bool = False, 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) DataFrame¶
执行紧密度中心性算法并返回结果流。
- 参数:
G (GraphV2) – 要使用的图对象
use_wasserman_faust (bool) – 使用改进的 Wasserman-Faust 公式进行紧密度计算。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
包含 nodeId 和 score 列的 DataFrame,包含紧密度中心性结果。每一行代表一个节点及其相应的紧密度中心性分数。
- 返回类型:
DataFrame
- abstract write(G: GraphV2, write_property: str, use_wasserman_faust: bool = False, 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, write_concurrency: int | None = None) ClosenessWriteResult¶
运行紧密中心度(Closeness Centrality)算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。
紧密度中心性是一种检测能够非常有效地在图中传播信息的节点的方法。节点的紧密度中心性衡量其到所有其他节点的平均远度(距离的倒数)。具有高紧密度分数的节点到所有其他节点的距离最短。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
use_wasserman_faust (bool | None, default=None) – 使用改进的 Wasserman-Faust 公式进行紧密度计算。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
ClosenessWriteResult – 算法指标和统计信息,包括已写入的属性数量
- 返回类型:
- class graphdatascience.procedure_surface.api.centrality.ClosenessHarmonicEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult¶
估算谐波紧密中心度(Harmonic Closeness Centrality)算法运行时的内存消耗。
- abstract mutate(G: GraphV2, mutate_property: str, 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) ClosenessHarmonicMutateResult¶
运行谐波中心度(Harmonic Centrality)算法,并将结果作为新的节点属性存储在图目录中。
谐波中心度(也称为有值中心度)是紧密中心度的一种变体,旨在解决原始公式在处理非连通图时遇到的问题。
- 参数:
- 返回:
算法度量和统计信息,包括中心性分布
- 返回类型:
- abstract stats(G: GraphV2, 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) ClosenessHarmonicStatsResult¶
运行谐波中心度算法并返回结果统计信息,而不存储结果。
谐波中心度由 Marchiori 和 Latora 提出,目的是寻求一种合理的“平均最短路径”概念。他们提出了一种与紧密中心度算法所使用的计算平均距离不同的方法。谐波中心度算法不是将节点到所有其他节点的距离求和,而是对这些距离的倒数进行求和。这使得它能够处理无限值。
- abstract stream(G: GraphV2, 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) DataFrame¶
执行谐波紧密中心度(Harmonic Closeness Centrality)算法并返回结果流。
- 参数:
- 返回:
包含 nodeId 和 score 列的算法结果 DataFrame
- 返回类型:
DataFrame
- abstract write(G: GraphV2, write_property: str, 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, write_concurrency: int | None = None) ClosenessHarmonicWriteResult¶
运行谐波中心度(Harmonic Centrality)算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。
谐波中心度由 Marchiori 和 Latora 提出,目的是寻求一种合理的“平均最短路径”概念。他们提出了一种与紧密中心度算法所使用的计算平均距离不同的方法。谐波中心度算法不是将节点到所有其他节点的距离求和,而是对这些距离的倒数进行求和。这使得它能够处理无限值。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
ClosenessHarmonicWriteResult – 算法指标和统计信息,包括中心度分布
- 返回类型:
- pydantic model graphdatascience.procedure_surface.api.centrality.ClosenessHarmonicMutateResult¶
以 mutate 模式运行谐波紧密中心度(Harmonic Closeness Centrality)算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.ClosenessHarmonicStatsResult¶
以 stats 模式运行谐波紧密中心度(Harmonic Closeness Centrality)算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.ClosenessHarmonicWriteResult¶
以 write 模式运行谐波紧密中心度(Harmonic Closeness Centrality)算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.ClosenessMutateResult¶
以 mutate 模式运行紧密中心度(Closeness Centrality)算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.ClosenessStatsResult¶
以 stats 模式运行紧密中心度(Closeness Centrality)算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.ClosenessWriteResult¶
以 write 模式运行紧密中心度(Closeness Centrality)算法的结果。
- class graphdatascience.procedure_surface.api.centrality.DegreeEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], orientation: str = 'NATURAL', relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None, relationship_weight_property: str | None = None) EstimationResult¶
预估算法运行的内存消耗。
- abstract mutate(G: GraphV2, mutate_property: str, orientation: str = 'NATURAL', 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, relationship_weight_property: str | None = None) DegreeMutateResult¶
运行度中心度(Degree Centrality)算法,并将结果作为新的节点属性存储在图目录中。
度中心度算法可用于查找图中的热门节点。度中心度测量节点中传入或传出(或两者兼有)的关系数量,这可以通过关系投影的方向来定义。它可以应用于加权图或无权图。在加权情况下,算法会计算图中每个节点的所有相邻关系的正权值之和。
- 参数:
G (GraphV2) – 要使用的图对象
mutate_property (str) – 用于存储结果的节点属性名称。
orientation (str | None) – 要考虑的关系方向。可以是 ‘NATURAL’、‘REVERSE’ 或 ‘UNDIRECTED’。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
- 返回:
算法度量和统计信息,包括中心性分布
- 返回类型:
- abstract stats(G: GraphV2, orientation: str = 'NATURAL', 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, relationship_weight_property: str | None = None) DegreeStatsResult¶
运行度中心度算法并返回结果统计信息,而不存储结果。
度中心度算法可用于查找图中的热门节点。度中心度测量节点中传入或传出(或两者兼有)的关系数量,这可以通过关系投影的方向来定义。它可以应用于加权图或无权图。在加权情况下,算法会计算图中每个节点的所有相邻关系的正权值之和。
- 参数:
G (GraphV2) – 要使用的图对象
orientation (str | None) – 要考虑的关系方向。可以是 ‘NATURAL’、‘REVERSE’ 或 ‘UNDIRECTED’。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
- 返回:
算法统计信息,包括中心性分布
- 返回类型:
- abstract stream(G: GraphV2, orientation: str = 'NATURAL', 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, relationship_weight_property: str | None = None) DataFrame¶
执行度中心性(Degree Centrality)算法并返回结果流。
- 参数:
G (GraphV2) – 要使用的图对象
orientation (str | None) – 要考虑的关系方向。可以是 ‘NATURAL’(自然)、‘REVERSE’(反向)或 ‘UNDIRECTED’(无向)。‘NATURAL’(默认)遵循图中存储的关系方向。‘REVERSE’ 将每种关系视为以相反方向连接。‘UNDIRECTED’ 将所有关系视为无向,实际上会计算两个方向的度数。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
- 返回:
包含 nodeId 和 score 列的 DataFrame,其中包含度中心性结果。每一行代表一个节点及其对应的度中心性得分。
- 返回类型:
DataFrame
- abstract write(G: GraphV2, write_property: str, orientation: str = 'NATURAL', 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, relationship_weight_property: str | None = None, write_concurrency: int | None = None) DegreeWriteResult¶
运行度中心性算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。
度中心度算法可用于查找图中的热门节点。度中心度测量节点中传入或传出(或两者兼有)的关系数量,这可以通过关系投影的方向来定义。它可以应用于加权图或无权图。在加权情况下,算法会计算图中每个节点的所有相邻关系的正权值之和。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
orientation (str | None) – 要考虑的关系方向。可以是 ‘NATURAL’、‘REVERSE’ 或 ‘UNDIRECTED’。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
DegreeWriteResult – 算法指标和统计信息,包括中心性分布和写入耗时。
- 返回类型:
- pydantic model graphdatascience.procedure_surface.api.centrality.DegreeMutateResult¶
以 mutate 模式运行度中心性算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.DegreeStatsResult¶
以 stats 模式运行度中心性算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.DegreeWriteResult¶
以 write 模式运行度中心性算法的结果。
- class graphdatascience.procedure_surface.api.centrality.EigenvectorEndpoints¶
- abstract estimate(G: GraphV2 | dict[str, Any], max_iterations: int = 20, tolerance: float = 1e-07, source_nodes: int | list[int] | None = None, scaler: str | dict[str, str | int | float] | ScalerConfig = 'NONE', relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) EstimationResult¶
预估算法运行的内存消耗。
- 参数:
max_iterations (int) – 运行的最大迭代次数。
tolerance (float) – 迭代之间得分的最小变化量。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起始点的节点 ID。可以是:- 单个节点 ID(例如,42) - 节点 ID 列表(例如,[42, 43, 44])
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_weight_property (str | None) – 用作权重的属性名称。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
concurrency (int | None) – 要使用的并发线程数。
- 返回:
包含估算结果的对象
- 返回类型:
- abstract mutate(G: GraphV2, mutate_property: str, max_iterations: int = 20, tolerance: float = 1e-07, source_nodes: int | list[int] | None = None, scaler: str | dict[str, str | int | float] | ScalerConfig = 'NONE', 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) EigenvectorMutateResult¶
运行特征向量中心性(Eigenvector Centrality)算法,并将结果作为新的节点属性存储在图目录中。
特征向量中心性是一种衡量节点传递影响力的算法。源自高分节点的关系对目标节点的得分贡献比来自低分节点的连接更大。高特征向量得分意味着该节点连接了许多自身也具有高得分的节点。该算法计算与最大绝对特征值相关的特征向量。
- 参数:
G (GraphV2) – 要使用的图对象
mutate_property (str) – 用于存储结果的节点属性名称。
max_iterations (int) – 运行的最大迭代次数。
tolerance (float) – 迭代之间得分的最小变化量。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起始点的节点 ID。可以是:- 单个节点 ID(例如,42) - 节点 ID 列表(例如,[42, 43, 44])
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_weight_property (str | None) – 用作权重的属性名称。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
算法度量和统计信息,包括中心性分布
- 返回类型:
- abstract stats(G: GraphV2, max_iterations: int = 20, tolerance: float = 1e-07, source_nodes: int | list[int] | None = None, scaler: str | dict[str, str | int | float] | ScalerConfig = 'NONE', 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) EigenvectorStatsResult¶
运行特征向量中心性算法并返回结果统计信息,而不存储结果。
特征向量中心性是一种衡量节点传递影响力的算法。源自高分节点的关系对目标节点的得分贡献比来自低分节点的连接更大。高特征向量得分意味着该节点连接了许多自身也具有高得分的节点。该算法计算与最大绝对特征值相关的特征向量。
- 参数:
G (GraphV2) – 要使用的图对象
max_iterations (int) – 运行的最大迭代次数。
tolerance (float) – 迭代之间得分的最小变化量。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起始点的节点 ID。可以是:- 单个节点 ID(例如,42) - 节点 ID 列表(例如,[42, 43, 44])
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_weight_property (str | None) – 用作权重的属性名称。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
算法统计信息,包括中心性分布
- 返回类型:
- abstract stream(G: GraphV2, max_iterations: int = 20, tolerance: float = 1e-07, source_nodes: int | list[int] | None = None, scaler: str | dict[str, str | int | float] | ScalerConfig = 'NONE', 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) DataFrame¶
执行特征向量中心性算法并返回结果流。
- 参数:
G (GraphV2) – 要使用的图对象
max_iterations (int) – 运行的最大迭代次数。
tolerance (float) – 迭代之间得分的最小变化量。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起始点的节点 ID。可以是:- 单个节点 ID(例如,42) - 节点 ID 列表(例如,[42, 43, 44])
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_weight_property (str | None) – 用作权重的属性名称。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
- 返回:
包含 nodeId 和 score 列的算法结果 DataFrame
- 返回类型:
DataFrame
- abstract write(G: GraphV2, write_property: str, max_iterations: int = 20, tolerance: float = 1e-07, source_nodes: int | list[int] | None = None, scaler: str | dict[str, str | int | float] | ScalerConfig = 'NONE', 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, write_concurrency: int | None = None) EigenvectorWriteResult¶
运行特征向量中心性算法,并将结果作为新的节点属性存储在 Neo4j 数据库中。
特征向量中心性是一种衡量节点传递影响力的算法。源自高分节点的关系对目标节点的得分贡献比来自低分节点的连接更大。高特征向量得分意味着该节点连接了许多自身也具有高得分的节点。该算法计算与最大绝对特征值相关的特征向量。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
max_iterations (int) – 运行的最大迭代次数。
tolerance (float) – 迭代之间得分的最小变化量。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起始点的节点 ID。可以是:- 单个节点 ID(例如,42) - 节点 ID 列表(例如,[42, 43, 44])
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_weight_property (str | None) – 用作权重的属性名称。
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
EigenvectorWriteResult – 算法指标和统计信息,包括中心性分布。
- 返回类型:
- pydantic model graphdatascience.procedure_surface.api.centrality.EigenvectorMutateResult¶
以 mutate 模式运行特征向量中心性算法的结果。
- pydantic model graphdatascience.procedure_surface.api.centrality.EigenvectorStatsResult¶
以 stats 模式运行特征向量中心性算法的结果。
- pydantic 模型 graphdatascience.procedure_surface.api.centrality.EigenvectorWriteResult¶
以写入模式运行特征向量中心度(Eigenvector Centrality)算法的结果。
- 类 graphdatascience.procedure_surface.api.centrality.PageRankEndpoints¶
- 抽象 estimate(G: GraphV2 | dict[str, Any], damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = 'NONE', relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) EstimationResult¶
预估算法运行的内存消耗。
- 参数:
damping_factor (float) – 阻尼系数,用于控制跳转到随机节点的概率
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
concurrency (int | None) – 要使用的并发线程数。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (Any | None, 默认=None) – 个性化 PageRank 的源节点
- 返回:
内存预估详情
- 返回类型:
- 抽象 mutate(G: GraphV2, mutate_property: str, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) PageRankMutateResult¶
运行 PageRank 算法并将结果作为新的节点属性存储在图目录中。
PageRank 算法通过入度边的数量以及对应源节点的重要性来衡量图中每个节点的重要性。从根本上讲,其基本假设是:一个页面的重要性取决于链接到该页面的其他页面的重要性。
- 参数:
G (GraphV2) – 要使用的图对象
mutate_property (str) – 用于存储结果的节点属性名称。
damping_factor (float) – 跳转到随机节点的概率。
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起点的节点 ID。可以是:- 单个节点 ID(例如 42) - 节点 ID 列表(例如 [42, 43, 44]) - 节点与偏差 > 0 的关联元组列表(例如 [(42, 0.5), (43, 1.0)])
- 返回:
算法指标和统计信息
- 返回类型:
- 抽象 stats(G: GraphV2, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) PageRankStatsResult¶
运行 PageRank 算法并返回结果统计信息,而不存储结果。
PageRank 算法通过入度边的数量以及对应源节点的重要性来衡量图中每个节点的重要性。从根本上讲,其基本假设是:一个页面的重要性取决于链接到该页面的其他页面的重要性。
- 参数:
G (GraphV2) – 要使用的图对象
damping_factor (float) – 跳转到随机节点的概率。
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, 默认=None) –
用作起点的节点 ID。可以是
单个节点 ID(例如,42)
节点 ID 列表(例如,[42, 43, 44])
元组列表,将每个节点与 > 0 的偏差相关联(例如,[(42, 0.5), (43, 1.0)])
- 返回:
算法统计信息
- 返回类型:
- 抽象 stream(G: GraphV2, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None) DataFrame¶
执行 PageRank 算法并返回结果流。
- 参数:
G (GraphV2) – 要使用的图对象
damping_factor (float) – 阻尼系数,用于控制跳转到随机节点的概率
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (Any | None, 默认=None) – 个性化 PageRank 的源节点
- 返回:
包含节点 ID 及其 PageRank 分数的 DataFrame
- 返回类型:
DataFrame
- 抽象 write(G: GraphV2, write_property: str, damping_factor: float = 0.85, tolerance: float = 1e-07, max_iterations: int = 20, scaler: str | dict[str, str | int | float] | ScalerConfig = '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, relationship_weight_property: str | None = None, source_nodes: int | list[int] | list[tuple[int, float]] | None = None, write_concurrency: int | None = None) PageRankWriteResult¶
运行 PageRank 算法并将结果作为新的节点属性存储在 Neo4j 数据库中。
PageRank 算法通过入度边的数量以及对应源节点的重要性来衡量图中每个节点的重要性。从根本上讲,其基本假设是:一个页面的重要性取决于链接到该页面的其他页面的重要性。
- 参数:
G (GraphV2) – 要使用的图对象
write_property (str) – 用于存储结果的节点属性名称。
damping_factor (float) – 跳转到随机节点的概率。
tolerance (float) – 迭代之间得分的最小变化量。
max_iterations (int) – 运行的最大迭代次数。
scaler (str | dict[str, str | int | float] | ScalerConfig) –
使用的缩放器。可以是:
字符串(例如:‘MinMax’, ‘Mean’, ‘Max’, ‘Log’, ‘StdScore’, ‘Center’, ‘NONE’)
包含缩放器配置的字典(例如:{‘type’: ‘Log’, ‘offset’: 1.0})
ScalerConfig实例
relationship_types (list[str]) – 使用给定的关系类型过滤图。将包含具有任何给定类型的关系。
sudo (bool) – 禁用内存保护。
log_progress (bool) – 显示进度日志。
username (str | None) – 作为管理员,模拟其他用户以访问其图。
concurrency (int | None) – 要使用的并发线程数。
job_id (str | None) – 计算任务的标识符。
relationship_weight_property (str | None) – 用作权重的属性名称。
source_nodes (int | list[int] | list[tuple[int, float]] | None, default=None) – 用作起点的节点 ID。可以是:- 单个节点 ID(例如 42) - 节点 ID 列表(例如 [42, 43, 44]) - 节点与偏差 > 0 的关联元组列表(例如 [(42, 0.5), (43, 1.0)])
write_concurrency (int | None) – 用于写入的并发线程数。返回
-------
PageRankWriteResult – 算法指标和统计信息
- 返回类型:
- pydantic 模型 graphdatascience.procedure_surface.api.centrality.PageRankMutateResult¶
- pydantic 模型 graphdatascience.procedure_surface.api.centrality.PageRankStatsResult¶
- pydantic 模型 graphdatascience.procedure_surface.api.centrality.PageRankWriteResult¶