overlap is a library for identifying overlaps on a list of segments.
You are given a list of segments that looks like this:
You are asked to identify any overlaps that are longer than m
, or which have at least n
segments overlapping.
This package allows you to do that, and identify, for instance, an overlap that is longer than 2 years and has at least 100 segments.
$ go get github.com/kchristidis/overlap
results, _ := overlap.Calculate("segments.csv", True)
f, _ := os.Create("overlaps.csv")
defer f.Close()
w := csv.NewWriter(f)
w.WriteAll(results) // calls Flush internally
You can also study the sample binary provided in cmd/overlap
, or read the package documentation in GoDoc.
Contributions are welcome. Fork this library and submit a pull request.