package forester
A tool for tending mathematical forests
Install
Dune Dependency
Authors
Maintainers
Sources
4.2.0.tar.gz
md5=7543fe7acbdfeb2056dc0b774965239f
sha512=2317bf84588692bbbd40e5fa944faab4889474e4a058e336bd1165f6dd8e55e8979affab098248c87354acdc3b6e6927305553ff5ab6b002b6739719814ec080
doc/src/forester.frontend/Import_graph.ml.html
Source file Import_graph.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
open Forester_core module Gph = struct module G = Graph.Imperative.Digraph.Concrete (Addr) include G include Graph.Oper.I (G) let safe_succ g x = if mem_vertex g x then succ g x else [] let safe_pred g x = if mem_vertex g x then pred g x else [] end module Topo = Graph.Topological.Make (Gph) let build_import_graph (trees : Code.tree list) = let import_graph = Gph.create () in let rec analyse_tree roots (tree : Code.tree) = let roots = Option.fold ~none:roots ~some:(fun x -> x :: roots) tree.addr in begin tree.addr |> Option.iter @@ fun addr -> Gph.add_vertex import_graph @@ User_addr addr end; tree.code |> List.iter @@ fun node -> match Asai.Range.(node.value) with | Code.Import (_, dep) -> roots |> List.iter @@ fun addr -> Gph.add_edge import_graph (User_addr dep) (User_addr addr) | Code.Subtree (addr, code) -> analyse_tree roots @@ Code.{tree with addr; code} | _ -> () in trees |> List.iter (analyse_tree []); import_graph
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>