wiheto / teneto

Temporal Network Tools
GNU General Public License v3.0
85 stars 26 forks source link

Network Properties calculation speed problem #87

Closed hexie1995 closed 2 years ago

hexie1995 commented 2 years ago

Hello there, I am trying to use teneto to calculate several network features for my temporal network, such as closeness centrality, shortest path and etc. Other than degree centrality that only took a few seconds to finish, they all takes very very long. I am inputing a 3 temporal layered, 50 nodes network, but it has taken more than 24 hours now and the closeness centrality calculation has not finished yet. I am wondering if there is a way to improve the speed of calculation?

hexie1995 commented 2 years ago

Also, I dont quite understand the example you have on your website: G = np.random.beta(1, 1, [5,5,3]) this will give me a 5x5x3 array, and I am not sure exactly what is the structure of the edgelist here because it is not in the format of "i j t".

However, if i try to calculate the shortest path by generating G= np.random.beta(1,1,[50,50,3]), the algorithm is really fast to calculate that, usually finishes within two minutes. But when I try to do the exact same calculation of shortest path but with a different input network I created myself, and let tnet be created from edgelist, it is extremely slow. Could you walk me through as why this is the case and what can I do to improve this?

tnet = TemporalNetwork(from_edgelist=A_tr_list, nettype='bd', diagonal=True)

wiheto commented 2 years ago

Known issue. #74. Whenever I have time to fix it, I will. All shortest paths outside of toy examples will take a long time to run cause of inefficient code when I tried to improve the algorithm.

Unfortunately, I am completely swamped with other obligations and have been unable to find a week in the last year where I can spend my free time fixing this as currently teneto is not supported under any research grant.

If critical, downgrade to the version where the algorithm runs quicker (I think 0.3.5 is the latest version), whenever betweenness centrality was added then the alg was made slower.

There are different network representations allowed. Array form and edgelist. See documentation.

wiheto commented 2 years ago

It is 0.3.5 when the alg is quicker. So I recommend using that if you need it. Again, I am sorry. When I have time to fix it, I will.