Closed torressa closed 4 years ago
The BiDirectional algorithm with direction='both' (default) path join and checking functions are inconsistent, sometimes resulting in invalid paths (final paths with edges not it the graph).
BiDirectional
direction='both'
How this can be fixed
The path joining function (https://github.com/torressa/cspy/blob/master/cspy/algorithms/bidirectional.py#L278) and path checking (https://github.com/torressa/cspy/blob/master/cspy/algorithms/bidirectional.py#L290) have to be altered to only join the forward and backward paths if they are not disconnected.
Quick Fix
For a quick fix, specify direction='forward'/'backward' when calling the BiDirectional algorithm.
direction='forward'/'backward'
Wasn't trivial but realised that negative cost cycles make things impossible for the algorithms check out networkx docs
Path joining algorithms still remains. Opened another, more specific issue #21
The
BiDirectional
algorithm withdirection='both'
(default) path join and checking functions are inconsistent, sometimes resulting in invalid paths (final paths with edges not it the graph).How this can be fixed
The path joining function (https://github.com/torressa/cspy/blob/master/cspy/algorithms/bidirectional.py#L278) and path checking (https://github.com/torressa/cspy/blob/master/cspy/algorithms/bidirectional.py#L290) have to be altered to only join the forward and backward paths if they are not disconnected.
Quick Fix
For a quick fix, specify
direction='forward'/'backward'
when calling theBiDirectional
algorithm.