diff --git a/README.md b/README.md index 9f570fcd..9f2eb47e 100644 --- a/README.md +++ b/README.md @@ -37,29 +37,86 @@ and `FRA` is the code for Frankfurt Airport. How many airports are directly connected to `FRA`? -directly connected +``` +?[count_unique(to)] := *route{fr: 'FRA', to} +``` + +| count_unique(to) | +|------------------| +| 310 | + How many airports are reachable from `FRA` by one stop? -one stop +``` +?[count_unique(to)] := *route{fr: 'FRA', to: 'stop}, + *route{fr: stop, to} +``` + +| count_unique(to) | +|------------------| +| 2222 | How many airports are reachable from `FRA` by any number of stops? -recursion +| count_unique(to) | +|------------------| +| 3462 | What are the two most difficult to reach airports by the minimum number of hops required, starting from `FRA`? -shortest routes +``` +reachable[to] := *route{fr: 'FRA', to} +reachable[to] := reachable[stop], *route{fr: stop, to} +?[count_unique(to)] := reachable[to] +``` + +``` +shortest_paths[to, shortest(path)] := *route{fr: 'FRA', to}, + path = ['FRA', to] +shortest_paths[to, shortest(path)] := shortest_paths[stop, prev_path], + *route{fr: stop, to}, + path = append(prev_path, to) +?[to, path, p_len] := shortest_paths[to, path], p_len = length(path) + +:order -p_len +:limit 2 +``` + +| to | path | p_len | +|-----|---------------------------------------------------|-------| +| YPO | ['FRA','YYZ','YTS','YMO','YFA','ZKE','YAT','YPO'] | 8 | +| BVI | ['FRA','AUH','BNE','ISA',"BQL','BEU','BVI'] | 7 | What is the shortest path between `FRA` and `YPO`, by actual distance travelled? -algorithm +``` +start[] <- [['FRA']] +end[] <- [['YPO]] +?[src, dst, distance, path] <~ ShortestPathDijkstra(*route[], start[], end[]) +``` + +| src | dst | distance | path | +|-----|-----|----------|--------------------------------------------------------| +| FRA | YPO | 4544.0 | ['FRA','YUL','YVO','YKQ','YMO','YFA','ZKE','YAT','YPO'] | Cozo attempts to provide nice error messages when you make mistakes: -error message +``` +?[x, Y] := x = 1, y = x + 1 +``` + +
eval::unbound_symb_in_head
+
+  × Symbol 'Y' in rule head is unbound
+   ╭────
+ 1 │ ?[x, Y] := x = 1, y = x + 1
+   · 
+   ╰────
+  help: Note that symbols occurring only in negated positions are not considered bound
+
## Install diff --git a/static/1_direct_reachable.png b/static/1_direct_reachable.png deleted file mode 100644 index 3627f2a5..00000000 Binary files a/static/1_direct_reachable.png and /dev/null differ diff --git a/static/2_one_hop_reachable.png b/static/2_one_hop_reachable.png deleted file mode 100644 index c6a4d1d5..00000000 Binary files a/static/2_one_hop_reachable.png and /dev/null differ diff --git a/static/3_all_rechable.png b/static/3_all_rechable.png deleted file mode 100644 index 8b6ed02e..00000000 Binary files a/static/3_all_rechable.png and /dev/null differ diff --git a/static/4_most_hops.png b/static/4_most_hops.png deleted file mode 100644 index 6d9bf71a..00000000 Binary files a/static/4_most_hops.png and /dev/null differ diff --git a/static/5_algo.png b/static/5_algo.png deleted file mode 100644 index 8d30aa2d..00000000 Binary files a/static/5_algo.png and /dev/null differ diff --git a/static/6_err_msg.png b/static/6_err_msg.png deleted file mode 100644 index 3da66a0b..00000000 Binary files a/static/6_err_msg.png and /dev/null differ diff --git a/static/release_process.md b/static/release_process.md deleted file mode 100644 index bf3079a5..00000000 --- a/static/release_process.md +++ /dev/null @@ -1,6 +0,0 @@ -1. build and release the main repo -2. use maturin to build and release cozo_embedded for python -3. use twine to release pycozo -4. build and release cozo-node with node-pre-gyp and npm -5. release cozo-lib-java to clojars -6. release cozo-clj to clojars \ No newline at end of file