Skip to main content

Euler diagrams in python

Project description

a night owl

Version downloads Binder

codecov Documentation Status Lint workflow

Euler's diagrams are non-empty Venn's diagrams. For further information about:

  1. the library: on URL https://eule.readthedocs.io;
  2. Euler diagrams: on wikipedia article https://en.wikipedia.org/wiki/Euler_diagram

Motivation

How to install

We run the command on desired installation environment:

pip install eule

Minimal example

Click to unfold usage

We run command python example.py on the folder with file example.py and following content:

#!/usr/bin/env python
from eule import euler, euler_keys, euler_boundaries, Euler

sets = {
    'a': [1, 2, 3],
    'b': [2, 3, 4],
    'c': [3, 4, 5],
    'd': [3, 5, 6]
}

euler_diagram = euler(sets)
euler_keys = euler_keys(sets)
euler_boundaries = euler_boundaries(sets)
euler_instance=Euler(sets)

# Euler dictionary:
# {('a', 'b'): [2], ('b', 'c'): [4], ('a', 'b', 'c', 'd'): [3], ('c', 'd'): [5], ('d', ): [6], ('a', ): [1]}
print(euler_diagram)
print(euler_instance.as_dict())

print('\n')

# Euler keys list:
# [('a', 'b'), ('b', 'c'), ('a', 'b', 'c', d'), ('c', 'd'), ('d', ), ('a', )]
print(euler_keys)
print(euler_instance.euler_keys())

print('\n')

# Euler boundaries dictionary:
# {
#   'a': ['b', 'c', 'd'],
#   'b': ['a', 'c', 'd'],
#   'c': ['a', 'b', 'd'],
#   'd': ['a', 'b', 'c']
# }
print(euler_boundaries)
print(euler_instance.euler_boundaries())

print('\n')

# Euler instance match:
# {'a'}
# {'a', 'b'}
# {'c', 'a', 'b'}

print(euler_instance.match({1,2,3}))
print(euler_instance.match({1,2,3,4}))
print(euler_instance.match({1,2,3,4,5}))

print('\n')

# Euler instance getitem dunder:
# [1, 2, 3]
# [1, 2, 3]
# [1, 2, 3, 4]
# [1, 2, 3, 4, 5]
print(euler_instance['a'])
print(euler_instance[('a', )])
print(euler_instance[('a', 'b', )])
print(euler_instance[('a', 'b', 'c',)])

print('\n')

# Euler instance remove_key:
# {('b', 'c'): [4], ('c', 'd'): [5], ('b', 'c', 'd'): [3], ('d',): [6], ('b',): [2]}
euler_instance.remove_key('a')
print(euler_instance.as_dict())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eule-1.3.0.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

eule-1.3.0-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page