# bigworld

compute diameter of flights graph
git clone https://a3nm.net/git/bigworld/
Log | Files | Refs

```commit dce073f6b88ce7068d71a418f687920097adb110
parent ed471b851356f54e99096d00683a0020c1cda1f3
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed, 20 May 2015 23:36:32 +0200

cleanup, fixes

Diffstat:
smallworld.cpp | 7++++---
smallworld.sh | 2+-
```
```2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/smallworld.cpp b/smallworld.cpp
@@ -1,10 +1,11 @@
#include <cstdio>
#include <map>
+#include <assert.h>
#include <vector>
#include <string>
#include <iostream>

-#define NMAX 3100
+#define NMAX 3200
//#define AMAX 20000
#define INF 20000
#define MULTI 200000
@@ -17,7 +18,6 @@ using namespace std;
int d[NMAX][NMAX];
int nx[NMAX][NMAX];
int airline[NMAX][NMAX];
-//char code[NMAX][10];
vector<string> code;
map<string, int> alias;
int fresh;
@@ -31,7 +31,6 @@ int main(int argc, char **argv) {
}
while (1) {
int a;
-    //char f[10], t[10];
int ret = scanf("%d", &a);
if (ret < 1)
break;
@@ -46,6 +45,8 @@ int main(int argc, char **argv) {
code.push_back(ts);
}
int f = alias[fs], t = alias[ts];
+    printf("%d %d\n", f, t);
+    assert(f < NMAX && t < NMAX);
airline[f][t] = (airline[f][t] && airline[f][t] != a) ? MULTI : a;
d[f][t] = 1;
nx[f][t] = t;
diff --git a/smallworld.sh b/smallworld.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-cut -d ',' -f1,8 airlines.dat | tr -d '"' | tr ',' ' ' > active
+cut -d ',' -f1,8 airlines.dat | tr -d '"' | tr ',' ' ' > active.dat
echo "\\N Y" >> active.dat
# sponge from moreutils
sort -k1,1 active.dat | sponge active.dat
```