← Back to team overview

oqgraph-dev team mailing list archive

Possible bug in breadth_first, or am I misunderstanding?

 

Hi

I have expanded the number of tests to cover more permutations.

So I hit this:

INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5);
...
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8;

returns a result, even when 8 doesnt exist in the graph

latch	origid	destid	weight	seq	linkid
2	8	NULL	0	1	8


it seems to be returning the same result as a node which only has inward links:

INSERT INTO graph_base(from_id, to_id) VALUES (5,7);
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7;

correctly returns

latch	origid	destid	weight	seq	linkid
2	7	NULL	0	1	7


I am assuming here, based on observation at this moment, that when using
breadth_first weight is calculated as the number of outward directed hops from
orig_id to the reachable node assigned to linkid.  So, a node with only inward
links will have a weight of zero, but surely a node which doesnt exist should
not return any result at all?

--Andrew