adding neo4j
This commit is contained in:
@@ -395,7 +395,17 @@ class Neo4JStorage(BaseGraphStorage):
|
|||||||
|
|
||||||
# edge_degree
|
# edge_degree
|
||||||
# from neo4j import GraphDatabase
|
# from neo4j import GraphDatabase
|
||||||
|
async def edge_degree(self, src_id: str, tgt_id: str) -> int:
|
||||||
|
entity_name__label_source = src_id
|
||||||
|
entity_name_label_target = tgt_id
|
||||||
|
with graph_db.session() as session:
|
||||||
|
result = session.run(
|
||||||
|
"""MATCH (n1:{node_label1})-[r]-(n2:{node_label2})
|
||||||
|
RETURN count(r) AS degree"""
|
||||||
|
.format(node_label1=node_label1, node_label2=node_label2)
|
||||||
|
)
|
||||||
|
record = result.single()
|
||||||
|
return record["degree"]
|
||||||
# driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password"))
|
# driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password"))
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user