fuzzy-graph-coloring is a Python package for calculating the fuzzy chromatic number and coloring of a graph with fuzzy edges.
Project description
fuzzy-graph-coloring is a Python package for calculating
the fuzzy chromatic number and coloring of a graph with fuzzy edges.
It will create a coloring with a minimal amount of incompatible edges
using a genetic algorithm (genetic_fuzzy_color
) or a greedy-k-coloring (greedy_k_color
)
combined with a binary search (alpha_fuzzy_color
).
If you don’t know which one to use, we recommend alpha_fuzzy_color
.
If you are looking for a networkX coloring but with a given k, use greedy_k_color
.
See repository https://github.com/ferdinand-dhbw/fuzzy-graph-coloring
Quick-Start
Install package: pip install fuzzy-graph-coloring
Try simple code:
import fuzzy-graph-coloring as fgc
TG1 = nx.Graph()
TG1.add_edge(1, 2, weight=0.7)
TG1.add_edge(1, 3, weight=0.8)
TG1.add_edge(1, 4, weight=0.5)
TG1.add_edge(2, 3, weight=0.3)
TG1.add_edge(2, 4, weight=0.4)
TG1.add_edge(3, 4, weight=1.0)
print(fgc.alpha_fuzzy_color(TG1, 3, return_alpha=True, fair=True))
Result: ({1: 0, 4: 1, 2: 2, 3: 2}, 0.918918918918919, 0.4)
(Tuple of coloring, score [(1-DTI)], and alpha [of alpha-cut])
Bibliography
The project uses a lot of the by Keshavarz created basics: E. Keshavarz, “Vertex-coloring of fuzzy graphs: A new approach,” Journal of Intelligent & Fuzzy Systems, vol. 30, pp. 883-893, 2016, issn: 1875-8967. https://doi.org/10.3233/IFS-151810
License
This project is licensed under GNU General Public License v3.0 (GNU GPLv3). See LICENSE
in the code repository.
Setup development environment
Get poetry https://python-poetry.org/docs/
Make sure, Python 3.8 is being used
poetry install
in your system shellpoetry run pre-commit install
Run pre-commit
poetry run pre-commit run --all-files
Run pytest
poetry run pytest .\tests
Create documentation
.\docs\make html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fuzzy-graph-coloring-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9572bd0fa3c0531a78decefa09335c3a8415c6a57da14e4243d0a502aae5be44 |
|
MD5 | 0a420e731c56d09925580ad913939be3 |
|
BLAKE2b-256 | 586f0e6f9265de84472f56292f07879c21c1ef20033a42f0de13d656dfefe69e |
Hashes for fuzzy_graph_coloring-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42bb7bdb17636810006e1b6a1d7442947f2dc2f26ffd81ff77772f49f87ce6d9 |
|
MD5 | 2ab4b7dda45207ee7553ac647721d524 |
|
BLAKE2b-256 | d0f8637cb5071690e827e05e9d6beca9a6556952b5539bc69d5d37a5695a5569 |