You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have experienced this also in a non concurrent environment. PredecessorMap() is guarded against nil access, I wonder if it was intended to leave it out in AdjacencyMap(). If not, would you accept a PR to add an initialization if the edge.Target is not found ?
While investigating this issue, it appeared to me that the code is correct on assuming the presence of a vertex, hence it would be, IMHO, a bad fix to just initialize the map on an un-existing source vertex because that would create a degenerate edge.
In our implementation of the store interface, we hit a panic because the store was returning edges with vertices that did not exist. So I went and opened a PR for reporting that error instead of panicking.
Activity
davidovich commentedon Oct 12, 2023
We have experienced this also in a non concurrent environment.
PredecessorMap()is guarded against nil access, I wonder if it was intended to leave it out inAdjacencyMap(). If not, would you accept a PR to add an initialization if theedge.Targetis not found ?dominikbraun commentedon Oct 13, 2023
@davidovich Yes.
AdjacencyMapshould behave exactly asPredecessorMapsince these functions do the same thing but complement each other.Fix potential panic on AdjacencyMap
davidovich commentedon Oct 13, 2023
While investigating this issue, it appeared to me that the code is correct on assuming the presence of a vertex, hence it would be, IMHO, a bad fix to just initialize the map on an un-existing source vertex because that would create a degenerate edge.
In our implementation of the store interface, we hit a panic because the store was returning edges with vertices that did not exist. So I went and opened a PR for reporting that error instead of panicking.