interval-map

  • b8_706741
    了解作者
  • 15.8KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-26 09:00
    上传日期
间隔图 实现为间隔树的不可变间隔图数据结构。 基于 。 间隔图非常适合查找间隔及其与给定间隔重叠的值。 此间隔图支持具有被排除的,包含的和无界的绑定末端的间隔。 多个值可以与相同间隔相关联。 安装 opam install interval-map 用法 let module Ivl_map = Interval_map. Make ( Int ) in let module Ivl = Ivl_map. Interval in (* Build the map *) let map = Ivl_map. empty |> Ivl_map. add ( Ivl. create ( Included 0 ) ( Excluded 10 )) " foo " |> Ivl_map. add ( Ivl. create ( Included 0 ) ( Excluded 10 ))
interval-map-main.zip
  • interval-map-main
  • .gitignore
    191B
  • Makefile
    2.1KB
  • .ocamlformat
    472B
  • LICENSE
    1KB
  • .github
  • workflows
  • ci.yml
    1.6KB
  • dune
    0B
  • README.md
    1.7KB
  • dune-project
    859B
  • script
  • release.sh
    588B
  • lib
  • bound.ml
    1.6KB
  • dune
    59B
  • interval_map.mli
    6.4KB
  • interval.ml
    1.4KB
  • interval_map.ml
    11KB
  • comparable.ml
    64B
  • CHANGES.md
    471B
  • interval-map.opam
    1.1KB
  • .gitattributes
    400B
  • test
  • support
  • test_runner.ml
    263B
  • dune
    317B
  • interval_map_test.ml
    6.9KB
内容介绍
# interval-map [![Actions Status](https://github.com/dgllghr/interval-map/workflows/CI/badge.svg)](https://github.com/dgllghr/interval-map/actions) [Documentation](https://dgllghr.github.io/interval-map/interval-map/index.html) An immutable interval map data structure implemented as an interval tree. Based on [jgblight/im_interval_tree](https://github.com/jgblight/im_interval_tree). Interval maps are great for finding intervals and their associated values which overlap a given interval. This interval map supports intervals with excluded, included, and unbounded bound ends. Multiple values may be associated with the same interval. ## Installation ```bash opam install interval-map ``` ## Usage ```ocaml let module Ivl_map = Interval_map.Make (Int) in let module Ivl = Ivl_map.Interval in (* Build the map *) let map = Ivl_map.empty |> Ivl_map.add (Ivl.create (Included 0) (Excluded 10)) "foo" |> Ivl_map.add (Ivl.create (Included 0) (Excluded 10)) "foo2" |> Ivl_map.add (Ivl.create (Excluded 0) (Included 10)) "bar" |> Ivl_map.add (Ivl.create (Included 5) (Included 10)) "baz" |> Ivl_map.add (Ivl.create (Excluded 4) (Excluded 10)) "oof" |> Ivl_map.add (Ivl.create Unbounded (Excluded 4)) "zab" in (* Query the map *) let query = Ivl.create Unbounded (Included 4) in Ivl_map.query_interval query map |> Ivl_map.Query_results.to_list (* Results: [({Ivl_map.Interval.low = Ivl_map.Bound.Unbounded; high = Ivl_map.Bound.Excluded 4}, ["zab"]); ({Ivl_map.Interval.low = Ivl_map.Bound.Included 0; high = Ivl_map.Bound.Excluded 10}, ["foo2", "foo"]); ({Ivl_map.Interval.low = Ivl_map.Bound.Excluded 0; high = Ivl_map.Bound.Included 10}, ["bar"])] *) ```
评论
    相关推荐