GraphGists

基于 Neo4j 和 Cypher 的多维图指标

本 Gist 的目的是演示我们在论文 Towards the characterization of realistic models: evaluation of multidisciplinary graph metrics 中收集的图指标。

数据集

作为示例,我们使用了一个简单的铁路网络,包括两条路线(Route)、三个区段(Segment)、一个道岔(Switch)和三个传感器(Sensor)

railway 1
图 1. 铁路网络

该示例可能的图表示形式如下

railway 2
图 2. 铁路图

这段短视频演示了铁路网络如何转换为图。

以下查询创建图(加载页面时会自动执行该查询)。

在下文中,我们将介绍指标的正式定义,并使用 Cypher 查询在示例图上对其进行评估。有关符号的详细信息,请参见论文

一维指标

聚类系数

\(C(v) = \frac {\big| a, b \mid \mathit{Connected}(v, a) \land \mathit{Connected}(v, b) \land \mathit{Connected}(a, b) \big|} {\big| a, b \mid \mathit{Connected}(v, a) \land \mathit{Connected}(v, b) \big|}\)

多维指标

在维度-节点对上解释的指标

维度度数

\(\mathit{Degree}\left(v,d\right) = \left|\big\{ w \in V \mid \mathit{Connected}(v, w, d) \big\}\right|\)

在维度上解释的指标

节点维度活跃度

\( \mathit{NDA}(d) = \big| \{ v \in V \mid \mathit{Active}(v,d) \} \big| \)

节点维度连通性

\( \mathit{NDC}(d) = \frac{\mathit{NDA}(d)}{|V|} \)

边维度活跃度

\( \mathit{EDA}(d) = \big| \{ (v,w,d) \in E \mid v,w \in V \} \big| \)

边维度连通性

\( \mathit{EDC}(d) = \frac{\mathit{EDA}(d)}{|E|} \)

在节点上解释的指标

节点活跃度

\( \mathit{NA}(v) = \big| \{ d \in D \mid \mathit{Active}(v, d) \} \big| \)

多重参与系数

\( \mathit{MPC}(v) = \frac{|D|}{|D| - 1} \left[ 1 - \sum\limits_{d\in D}^{}{\left(\frac{\mathit{Degree}(v,d)}{\mathit{Degree}(v,D)}\right)^2} \right] \)
维度聚类系数

DC1 变体

\( \mathit{DC}_1(v) = \frac {\big| a, b \mid \mathit{Connected}(v, a, d_1) \land \mathit{Connected}(v, b, d_1) \land \mathit{Connected}(a, b, d_2) \land d_1 \neq d_2 \big|} {\big| a, b \mid \mathit{Connected}(v, a, d_1) \land \mathit{Connected}(v, b, d_1) \big|} \)

DC2 变体

\( \mathit{DC}_2(v) = \frac {\big| a, b \mid \mathit{Connected}(v, a, d_1) \land \mathit{Connected}(v, b, d_2) \land \mathit{Connected}(a, b, d_3) \land d_1 \neq d_2 \land d_2 \neq d_3 \land d_1 \neq d_3 \big|} {\big| a, b \mid \mathit{Connected}(v, a, d_1) \land \mathit{Connected}(v, b, d_2) \land d_1 \neq d_2 \big|)} \)

在维度对上解释的指标

每个节点 v节点活跃度二元向量定义为

\( a_v = \left\{ a_v^{[1]},a_v^{[2]}, \dots, a_v^{[|D|]} \right\}, \text{where } a_v^{[d]} = \begin{cases} 1, & \text{if } \mathit{Active}(v,d),\\ 0, & \text{otherwise} \end{cases} \)

使用此向量,成对多重性指标为

\( Q(d_1, d_2) = \frac{1}{|V|} \sum_{v \in V} {a_v^{[d_1]} a_v^{[d_2]}} \)
© . All rights reserved.