Get visited edges in OrientDB's shortestPath()

北战南征 提交于 2019-12-03 14:11:36

OrientDB has collection and map types. To make a collection the result set (what you're interested) you've to flatten it:

select flatten( shortestpath(" + firstVertex + ", " + secondVertex + ") )

To get the edges outgoing edges there are so many ways. Below a few of them:

select vertices.out from (
   select flatten( shortestpath(" + firstVertex + ", " + secondVertex + ") ) as vertices
)

Or also:

select flatten( shortestpath(" + firstVertex + ", " + secondVertex + ").out )

For me, it didn't work how dante or Lvca explained it:

select flatten(shortestPath) from (select shortestPath(#12:0,#12:2,'BOTH')

This lead to errors in the console or to no records returned in the OrientDB Studio.

Instead, when I used an alias for the function result, it worked finally. So maybe try out this form:

select flatten(sp) from (select shortestPath(#12:0,#15:2,'BOTH') as sp)

(Note. I'm using v1.7.4)

Try

select expand(shortestPath) from (select shortestPath(" + firstVertex + ", " + secondVertex + "))

You will receive vertices.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!