wiheto / teneto

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

error in dataframe undirected network #53

Closed wiheto closed 4 years ago

wiheto commented 4 years ago

Mentioned in #52:

File "", line 1, in shortest_paths = tnt.networkmeasures.shortest_temporal_path(t)

File "C:\ProgramData\Anaconda3\lib\site-packages\teneto\networkmeasures\shortest_temporal_path.py", line 201, in shortest_temporal_path network = tnet.get_network_when(ij=list(ij), t=t)

File "C:\ProgramData\Anaconda3\lib\site-packages\teneto\classes\network.py", line 483, in get_network_when return teneto.utils.get_network_when(self, **kwargs)

File "C:\ProgramData\Anaconda3\lib\site-packages\teneto\utils\utils.py", line 993, in get_network_when network['j'].isin(ij))), (network['t'].isin(t)))]

TypeError: and_ expected 2 arguments, got 1

wiheto commented 4 years ago

So this works for me with the latest fix on the develop branch. @alberto-bracci could you confirm that it works for you with the code you were running?

Before this would fail, but now it is fixed:

import teneto
tnet_array = teneto.generatenetwork.rand_binomial((3,5), 0.5)  
tnet = teneto.TemporalNetwork(from_array=tnet_array, forcesparse=True, nettype='bu')
paths = teneto.networkmeasures.shortest_temporal_path(tnet)                        
alberto-bracci commented 4 years ago

this works. just to understand: forcesparse=True uses HDF5 too? Does forcesparse=True slow down the computation of shortest paths as well?

wiheto commented 4 years ago

So there are three types of network representations in teneto:

  1. numpy array (when the network is dense).
  2. A pandas dataframe where each row is i,j,t.
  3. A HDF5 dataframe where each row is i,j,t.

In regards to memory usage ranks: 3,2,1. In regards to processing speed it ranks 1,2,3 (but all are currently too slow compared to their optimal speed). When introducing 2,3 to improve memory usage (around March-April this year), I compromised on speed. And I haven't had time to fully fix the issues. It has improved a bit, but not completely. Hence the time alotted in December to get to the bottom of this.

The error that you identified here was for both representations 2,3 (that's why I didn't put in hdf5=True).

Sorry if I confused you with the title of the issue.