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

docs: added adjacency list example to exercise 080 #2769

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions data/exercises/080_conversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ edge is a pair of different nodes.*
There are several ways to represent graphs in OCaml.

* One method is to list all edges, an edge being a pair of nodes. In
this form, the graph depicted opposite is represented as the
this form, the graph depicted above is represented as the
following expression:

```ocaml
Expand Down Expand Up @@ -67,10 +67,19 @@ may want to define a similar type using sets instead of lists.
**adjacency-list form**. In our example:

```ocaml
(* example pending *)
let adjacency_example = ['b', ['c'; 'f'];
'c', ['b'; 'f'];
'd', [];
'f', ['b'; 'c'; 'k'];
'g', ['h'];
'k', ['f']
];;
val adjacency_example : (char * char list) list =
[('b', ['c'; 'f']); ('c', ['b'; 'f']); ('d', []); ('f', ['b'; 'c'; 'k']);
('g', ['h']); ('k', ['f'])]
```

* The representations we introduced so far well suited for automated
* The representations we introduced so far are well suited for automated
processing, but their syntax is not very user-friendly. Typing the
terms by hand is cumbersome and error-prone. We can define a more
compact and "human-friendly" notation as follows: A graph (with char
Expand Down
Loading