Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in dataframe undirected network #53

Closed
wiheto opened this issue Nov 14, 2019 · 3 comments
Closed

error in dataframe undirected network #53

wiheto opened this issue Nov 14, 2019 · 3 comments

Comments

@wiheto
Copy link
Owner

wiheto commented Nov 14, 2019

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
Copy link
Owner Author

wiheto commented Nov 14, 2019

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
Copy link

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

@wiheto wiheto changed the title error in HDF5 undirected network error in dataframe undirected network Nov 15, 2019
@wiheto
Copy link
Owner Author

wiheto commented Nov 15, 2019

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.

@wiheto wiheto closed this as completed Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants