5
$\begingroup$

Consider the graph:

<< IGraphM` (* package *)
net = RandomGraph[BarabasiAlbertGraphDistribution[2000000, 1]];
net2 = Graph[net, EdgeWeight -> RandomInteger[{1, 20}, EdgeCount[net]]];
ver = VertexList[net2];
bin = {3};
list = IGDistanceHistogram[net2, bin[[1]], {ver[[10]]}]

Sometimes, for a large networks and a large set of 'bin' calculations take a long time. However, I am only interested in the first value of the list 'list':

FinalResult=list[[1]]

How to force the IGDistanceHistogram[] command to count only the value for the first bin size?

$\endgroup$
  • $\begingroup$ I do not understand the question. Are you asking if there is a way to get only First@IGDistanceHistogram[...] and have the calculation finish faster? Is the question about performance? $\endgroup$ – Szabolcs May 1 at 13:43
  • $\begingroup$ But to calculate the First[...] must calculate the whole set IGDistanceHistogram[...] and then First[...]. The point is not to count the entire set but only the first element and not count the next. $\endgroup$ – ralph May 1 at 14:07
  • $\begingroup$ So your motivation is performance? You just want it faster? $\endgroup$ – Szabolcs May 1 at 14:10
  • 2
    $\begingroup$ It may be possible to do something about performance in other ways, but I am not willing to do what you are asking for specifically (only count the first bin). It would require a complete re-implementation of the shortest path finder, and I do not have the time for that. If you are up for it, and are comfortable with C programming, you are very welcome to contribute this improvement. $\endgroup$ – Szabolcs May 1 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.