Open biraj01 opened 7 years ago
After spending fast a day for this simple query, i found a result for it, but is there not any easy method to find all paths between Vertex A and Vertex B?
IListgraph_0_target
, graph_0_unused
, graph_0_Path
in 1..6 any @P1 graph \"hls\" filter ( graph_0_target
._id
== @P2 ) return graph_0_Path
", par2);
@biraj01 if you mean this example. it can be written in LINQ
public class EdgeCollection
{
[DocumentProperty(Identifier = IdentifierType.Key)]
public string Key { get; set; }
}
public class VertexCollection
{
[DocumentProperty(Identifier = IdentifierType.Key)]
public string Key { get; set; }
}
var result = db.Query()
.Traversal<VertexCollection, EdgeCollection>("from-vertex")
.Depth(0, 5)
.AnyDirection()
.Graph("graph-name")
.Where(x => x.Vertex.Key == "to-vert")
.Select(x => x.Path)
//.ToList()
.GetQueryData();
Console.WriteLine(result.QueryReplacedWithVariables(db));
// will print
//for `graph_0_Vertex`, `graph_0_Edge`, `graph_0_Path` in 0..5 any "from-vertex" graph "graph-name"
//filter ( `graph_0_Vertex`.`_key` == "to-vert" )
//return `graph_0_Path`
You have a filter matching any vertex of graph to "to-vert"
filter ( graph_0_Vertex
._key
== "to-vert" )
But my query is to filter every path which target is equal to "to-vert"
filter ( graph_0_target._id == "to-vert")
@biraj01 graph_0_Vertex
is same as graph_0_target
, both are target vertices in traversal.
So far works the methods Transversal and ShortestPath perfect, but I cannot find any method to get list of all Paths between Vertex A and Vertex B.