Permalink
Browse files

Make it possible to pass dgraph.metric.betweenness a buffer

to store centrality values.
  • Loading branch information...
WebDrake committed Sep 19, 2013
1 parent b2cfcf7 commit 37a68287ff578b954bee17d423175a2d78fd8954
Showing with 7 additions and 1 deletion.
  1. +7 −1 dgraph/metric.d
View
@@ -86,10 +86,16 @@ unittest
* The optional function parameter ignore allows the user to indicate
* individual vertices to ignore in the calculation.
*/
auto betweenness(T = double, Graph)(ref Graph g, bool[] ignore = null)
auto ref betweenness(T = double, Graph)(ref Graph g, bool[] ignore = null)
if (isFloatingPoint!T && isGraph!Graph)
{
T[] centrality = new T[g.vertexCount];
return betweenness!(T, Graph)(g, centrality, ignore);
}
auto ref betweenness(T = double, Graph)(ref Graph g, ref T[] centrality, bool[] ignore = null)
{
centrality.length = g.vertexCount;
centrality[] = to!T(0);
size_t[] stack = new size_t[g.vertexCount];
T[] sigma = new T[g.vertexCount];

0 comments on commit 37a6828

Please sign in to comment.