概述
函数pedges()
将路径中所有边的信息依次放入一个列表。
参数:pedges(<path>)
<path>
:路径
返回值:
- 边信息组成的列表
一般用法
示例图集:
![](https://img.ultipa.cn/draw/draw_7d6a28dbf9f54170ac9537f312b2e3d8.jpg?v='')
在一个空图集中,依次运行以下各行语句创建示例图集:
create().node_schema("firm").node_schema("human").edge_schema("hold")
create().edge_property(@hold, "portion", double)
insert().into(@firm).nodes([{_id:"F001", _uuid:1}, {_id:"F002", _uuid:2}])
insert().into(@human).nodes([{_id:"H001", _uuid:3}, {_id:"H002", _uuid:4}])
insert().into(@hold).edges([{_uuid:1, _from_uuid:3, _to_uuid:1, portion:0.3}, {_uuid:2, _from_uuid:2, _to_uuid:1, portion:0.7}, {_uuid:3, _from_uuid:3, _to_uuid:2, portion:0.4}, {_uuid:4, _from_uuid:4, _to_uuid:2, portion:0.6}])
本例计算各个最终受益人对公司F001的持股路径,返回各条路径的边信息列表:
n({_id == "F001"}).le()[:5].n({@human} as UBO) as p
return pedges(p)
[{"uuid":"1","from":"H001","to":"F001","from_uuid":"3","to_uuid":"1","schema":"hold","values":{"portion":"0.3"}}]
[{"uuid":"2","from":"F002","to":"F001","from_uuid":"2","to_uuid":"1","schema":"hold","values":{"portion":"0.7"}},{"uuid":"3","from":"H001","to":"F002","from_uuid":"3","to_uuid":"2","schema":"hold","values":{"portion":"0.4"}}]
[{"uuid":"2","from":"F002","to":"F001","from_uuid":"2","to_uuid":"1","schema":"hold","values":{"portion":"0.7"}},{"uuid":"4","from":"H002","to":"F002","from_uuid":"4","to_uuid":"2","schema":"hold","values":{"portion":"0.6"}}]