通用网络分析Shiny APP示例
Cypher语句
结点列表
边列表
可视化分析
投影语句
Cypher语句
MATCH (china:Airport)-[:IN_COUNTRY]->(c:Country{code:"CN"}) WITH COLLECT(china.id) AS targets MATCH path = (source:Airport{descr:"Zhuhai Airport"})-[r:HAS_ROUTE*2..3]->(target) WHERE target.descr = source.descr AND ALL( node IN nodes(path) where node.id IN targets) WITH path, [r in relationships(path)|r.distance] AS distances, 0.5 AS amplitude, 500 AS threshold WITH path, apoc.coll.avg(distances) AS avgDist, apoc.coll.min(distances) as minDist, apoc.coll.max(distances) as maxDist WHERE minDist/avgDist >= (1-amplitude) AND maxDist/avgDist <= (1+amplitude) AND avgDist >= threshold //WITH path, apoc.coll.median(distances) AS medianDist, apoc.coll.min(distances) as minDist, apoc.coll.max(distances) as maxDist //WHERE minDist/medianDist >= (1-amplitude) AND maxDist/medianDist <= (1+amplitude) AND medianDist >= threshold WITH path, relationships(path) as flights UNWIND flights AS flight WITH DISTINCT flight MATCH (n:Airport)-[flight]->(m:Airport) RETURN n.descr AS source, m.descr as target, flight.distance AS distance;
执行查询
选中结点
设为源结点
机场航线网络
国内机场
记录点击的结点
连续选取结点
用曲线展开多重边
传出选中结点
清除选中结点
APP状态
选中的结点
投影语句
CALL gds.graph.project.cypher( 'airportsNetwork_CN', 'MATCH (n:Airport)-[:IN_COUNTRY]->(c:Country{code:"CN"}) RETURN id(n) AS id', 'MATCH (startNode:Airport)-[r:HAS_ROUTE]->(targetNode:Airport), (startNode:Airport)-[:IN_COUNTRY]->(c:Country{code:"CN"}), (targetNode:Airport)-[:IN_COUNTRY]->(c:Country{code:"CN"}) RETURN id(startNode) AS source, id(targetNode) AS target, r.distance AS distance' ) YIELD graphName AS graph, nodeQuery, nodeCount AS nodes, relationshipQuery, relationshipCount AS rels RETURN graph, nodes, rels;
执行投影