Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,6 @@
def weights: {
"1": {"3": -2},
"2": {"1" : 4, "3": 3},
"3": {"4": 2},
"4": {"2": -1}
};

View file

@ -0,0 +1,21 @@
def fwi:
. as $weights
| keys_unsorted as $nodes
# construct the dist matrix
| reduce $nodes[] as $u ({};
reduce $nodes[] as $v (.;
.[$u][$v] = infinite))
| reduce $nodes[] as $u (.; .[$u][$u] = 0 )
| reduce $nodes[] as $u (.;
reduce ($weights[$u]|keys_unsorted[]) as $v (.;
.[$u][$v] = $weights[$u][$v] ))
| reduce $nodes[] as $w (.;
reduce $nodes[] as $u (.;
reduce $nodes[] as $v (.;
(.[$u][$w] + .[$w][$v]) as $x
| if .[$u][$v] > $x then .[$u][$v] = $x
else . end )))
;
weights | fwi