# Graph problem with IGraphM package

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?

• 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? – Szabolcs May 1 at 13:43
• 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. – ralph May 1 at 14:07
• So your motivation is performance? You just want it faster? – Szabolcs May 1 at 14:10
• 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. – Szabolcs May 1 at 14:12