Permalink
Browse files

Reduce (we hope) the amount of allocation inside betweenness loop.

  • Loading branch information...
1 parent 271c7d5 commit 593e77ae1339ebc286c893d782e49c284774cda4 @WebDrake committed Jul 12, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 dgraph/metric.d
View
@@ -80,12 +80,13 @@ auto betweenness(T = double, bool directed)(ref Graph!directed g, bool[] ignore)
T[] delta = new T[g.vertexCount];
long[] d = new long[g.vertexCount];
auto q = VertexQueue(g.vertexCount);
+ size_t[][] p = new size_t[][g.vertexCount];
foreach (s; 0 .. g.vertexCount)
{
if (!ignore[s])
{
- size_t[][] p = new size_t[][g.vertexCount];
+ p[] = [];
size_t stackLength = 0;
assert(q.empty);
sigma[] = to!T(0);

0 comments on commit 593e77a

Please sign in to comment.