You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should we go in the direction of the Haskell implementation? They are well described in the paper (and well commented in the source code). Do you have other plans? Where would you place the functions - a lot of them work on general graphs - others are rather specific to undirected/directed graphs (pretty much everything with the u or r prefix). What module/submodule/namespace order would you suggest?
First attempt
I played around with the examples in the aformentioned blog post and translated the given DFS example to F# (still - I think a better way would be to stick to the FGL implementation). What do you think?
letdfs(nodes :'Vertex list)(graph :Graph<'Vertex,'Label,'Edge>):'Vertex list =let recdfs(nodes :'Vertex list)(graph :Graph<'Vertex,'Label,'Edge>):'Vertex list =match nodes, graph with|([],_)->[]|(_, g)when Graph.isEmpty g ->[]|(n::ns, g)->match Graph.tryDecompose n g with|(Some c, g')->letneighbours= Undirected.Vertices.neighbours c
n::(dfs (neighbours @ ns) g')// n::(dfs (Undirected.Vertices.neighbours c)::ns g')| None,_-> dfs ns g
dfs nodes graph
Activity