Neo4j中按标签显示的节点百分比

时间:2019-02-05 15:49:09

标签: neo4j nodes

如何在Neo4j中按标签获取节点的百分比?

应该是这样吗?:

MATCH (n)
WITH COUNT(*) As total
MATCH (n)
WHERE NOT (n)--()
WITH DISTINCT count(labels(n)) as c, labels(n) as l
RETURN (c/total)*100, l;

谢谢。

1 个答案:

答案 0 :(得分:0)

获取此信息的最快方法是通过计数存储,而APOC Procedures具有最简单的方法来一次访问所有信息:

  Dim Query As String
            Query = "Select * from Charges where DOctype='" & comboBoxTranType.Text & "'"
            Dim cmd As New SqlCommand(Query, con)
            con.Open()
            Dim dataAdapter As New SqlDataAdapter(Query, con)
            Dim dt As New DataTable
            dataAdapter.Fill(dt)
            dataAdapter.Dispose()
    If dt.Rows.Count > 0 Then
              LabelV001.Text = dt.Rows(0).Item("Head").ToString()
                LabelV002.Text = dt.Rows(1).Item("Head").ToString()
                LabelV003.Text = dt.Rows(2).Item("Head").ToString()
            End If


 If dt.Rows.Count > 0 Then

                    LabelFIELD1.Text = dt.Rows(0).Item("Equation").ToString()
                    LabelFIELD2.Text = dt.Rows(1).Item("Equation").ToString()
                    LabelFIELD3.Text = dt.Rows(2).Item("Equation").ToString()

                End If

                con.Close()



            End Sub

请记住,由于可以对节点进行多标签处理,因此您的百分比可能会超过100%。