BFS not return any data

Hi can any one see what stupid mistake I am trying to use BFS return but it not return data. (running the latest image that you can pull from docker). I know the graph exist. I want to use BFS to remove cycles, and duplicate edges between nodes…
ResultSet resultSet = graph.query(graphID,“CALL algo.BFS ( 1 ,20,NULL) YIELD nodes as n, edges as e return n, e” );

1 is my start index of my start node node I believe is should be the index of the redisgraph node.

On a side note but related, i was doing some thing like the below as another path forward. Which seem to work, but concern about loop in the graph. When I add a loop in to the graph it seem to gard against loops, is their any more information about this.
ResultSet r2 = graph.query(graphID,"MATCH p=(a:resource {_id : _id })-[*1..20]-(:resource{_id: _idEnd}) return p ",params);

Doh I think I worked it out , need to have a match on the front. That was not clear from the docs
MATCH (a:resource) WHERE (a._id = $_id ) CALL algo.BFS ( a ,0,NULL) YIELD nodes as n, edges as e return n, e

1 Like

Hi @jonnysettle,

Your solution is right; the first argument to BFS should be an actual node from a previous MATCH.

With respect to your question about looping, variable-length traversals will follow each edge a maximum of one time to prevent cycles from producing unbounded results.

Thanks, :slight_smile: :grinning:

BFS is also directional ? is there any way of making it ignore edge direction. (I suppose I could just add the inverse, but it seem like a bit of hack)

Sorry, we don’t have an option for direction-agnostic BFS right now!