KeRNeLith / QuikGraph

Generic Graph Data Structures and Algorithms for .NET
https://kernelith.github.io/QuikGraph/
Microsoft Public License
453 stars 65 forks source link

[BUG] Documentation doesn't clearly state how edgeCapacity parameter of BidirectionalGraph is used #79

Open INRIX-Mark-Gershaft opened 10 months ago

INRIX-Mark-Gershaft commented 10 months ago

Describe the bug Documentation about edgeCapacity is leading into belief that it is equivalent to vertexCapacity while it actually results in allocation of "edgeCapacity" entries for each vertex.

To Reproduce Steps to reproduce the behavior:

var graph = new BidirectionalGraph<SegmentVertex, SegmentEdge<TSegment>>(allowParallelEdges: true, vertexCapacity: segments.Length, edgeCapacity: segments.Length);
. . .
graph.AddVertexRange(vertices); // <<<< OOM because it allocates 2 * segments.Length * segment.Length objects
// 2x because it allocates in and out collections 
// segment.Length * segment.Length because for each vertex it allocates edgeCapacity expected edges.

Expected behavior A clear and concise description of what edgeCapacity is for - expected valency of vertices.