Skip to content
/ mieda Public

Merging of set-containing Intervals Efficiently with a Directed-graph Algorithm

License

Notifications You must be signed in to change notification settings

vc1492a/mieda

Repository files navigation

MIEDA

Merging of Set-Containing Intervals Efficiently with a Directed-Graph Algorithm

License PyPi Build Status Coverage Status

MIEDA can be used to merge overlapping intervals, dependent on the intersection of sets contained within the intervals themselves. MIEDA utilizes a directed-graph algorithm for merging the intervals rapidly and with scalability.

images

Dependencies

  • Python 3.5 - 3.8
  • NetworkX >= 2.4.0

How To

First install the package locally:

pip install mieda # or pip3 install ... if you're using both Python 3 and 2.

To merge intervals containing sets, pass a list of dictionaries as shown in the below example:

import datetime
from mieda.intervals import Merge

intervals = [
    {"start": datetime.datetime(2020, 1, 1, 1, 0, 0), "finish": datetime.datetime(2020, 1, 4, 1, 0, 0),
     "set_items": {"1"}},
    {"start": datetime.datetime(2020, 1, 1, 1, 0, 0), "finish": datetime.datetime(2020, 1, 3, 1, 0, 0),
     "set_items": {"2"}}
]

print(Merge.union(intervals=intervals))

Contributing

If you would like to contribute, please fork the repository and make any changes locally prior to submitting a pull request. Feel free to open an issue if you notice any erroneous behavior.

Versioning

Semantic versioning is used for this project. If contributing, please conform to semantic versioning guidelines when submitting a pull request.

License

This project is licensed under the Apache 2.0 license.

Research

If citing mieda in your research, please use the following:

@article{ConstantinouMishra2020,
  doi = {},
  url = {},
  year  = {},
  month = {},
  publisher = {},
  volume = {},
  number = {},
  pages = {},
  author = {Valentino Constantinou, Asitang Mishra},
  title = {},
  journal = {}
}

Tests

Tests are contained within the tests directory. To run tests for MIEDA, call pytest and pytest-cov via the command line:

python3 -m pytest --cov=mieda -vv

Setting up a virtual environment for testing and development is recommended.

About

Merging of set-containing Intervals Efficiently with a Directed-graph Algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published