Advertisement
Guest User

Untitled

a guest
Dec 26th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.22 KB | None | 0 0
  1. type node = int
  2. type graph = (node * float * node ) list
  3.  
  4. let g = [(0, 0.5, 1); (1, 0.2, 3); (1, 0.8, 4); (2, 0.4, 4)]
  5.  
  6. let adjacent_nodes n g = List.fold_left (fun (a,b,c) out -> if a = n then (c,b)::out else out) [] g
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement