Closed mfe- closed 4 years ago
When generating more than 250000 edges with Generate_Grid_Graph there are many collisions using Edge.GetHashCode
Generate_Grid_Graph
Edge.GetHashCode
return Math.Abs(U.GetHashCode()) + (V != null ? Math.Abs(V.GetHashCode()) : 0); U.GetHashCode() = return this._Guid.Equals((obj as Vertex)?._Guid);
Currently workaround.
return ($"{U}{V}" == $"{edge.U}{edge.V}" || $"{U}{V}" == $"{edge.V}{edge.U}");
Maybe the Guid of the Vertex should be exposed in IVertex so it can be used for comparison in the implementation of Edge. The Edge itself could generate a new Guid of Vertex.U and Vertex.V.
IVertex
Edge
https://gist.github.com/mfe-/c23279f73f1b2373eeeb4a8baa5d7906
Workaround with return ($"{U}{V}" == $"{edge.U}{edge.V}" || $"{U}{V}" == $"{edge.V}{edge.U}"); seems to be efficiency enough.
When generating more than 250000 edges with
Generate_Grid_Graph
there are many collisions usingEdge.GetHashCode
Currently workaround.
Maybe the Guid of the Vertex should be exposed in
IVertex
so it can be used for comparison in the implementation ofEdge
. The Edge itself could generate a new Guid of Vertex.U and Vertex.V.https://gist.github.com/mfe-/c23279f73f1b2373eeeb4a8baa5d7906