rogueviz::kohonen:: halt with error when reading graph unsuccessfully

This commit is contained in:
Zeno Rogue 2018-11-24 01:31:15 +01:00
parent 0d691ab16a
commit 6336fe9db6
1 changed files with 6 additions and 1 deletions

View File

@ -1100,7 +1100,12 @@ void load_edges(const string& fname_edges, string edgename, int pick = 0) {
distribute_neurons();
int i = 0;
for(auto p: edgedata2)
addedge(p.first, p.second, 1 / (i+++.5), true, t);
if(p.first >= 0 && p.second >= 0)
addedge(p.first, p.second, 1 / (i+++.5), true, t);
else {
printf("error reading graph\n");
exit(1);
}
}
void random_edges(int q) {