Skip to main content

fuzzy-graph-coloring

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 See the paper that accompanied the project https://github.com/ferdinand-dhbw/fuzzy-graph-coloring/blob/main/docs/KoenigRheinerFGCStudentResearchProject2022.pdf

Quick-Start

Install package: pip install fuzzy-graph-coloring Consider the following graph:

https://raw.githubusercontent.com/ferdinand-dhbw/fuzzy-graph-coloring/main/docs/images/uncolored-graph.png

Try simple code:

import fuzzy-graph-coloring as fgc

TG2 = nx.Graph()
TG2.add_edge(1, 2, weight=0.4)
TG2.add_edge(1, 3, weight=0.7)
TG2.add_edge(1, 4, weight=0.8)
TG2.add_edge(2, 4, weight=0.2)
TG2.add_edge(2, 5, weight=0.9)
TG2.add_edge(3, 4, weight=0.3)
TG2.add_edge(3, 6, weight=1.0)
TG2.add_edge(4, 5, weight=0.3)
TG2.add_edge(4, 6, weight=0.5)
TG2.add_edge(5, 6, weight=0.7)
TG2.add_edge(5, 7, weight=0.8)
TG2.add_edge(5, 8, weight=0.5)
TG2.add_edge(6, 7, weight=0.7)
TG2.add_edge(7, 8, weight=0.6)

print(fgc.alpha_fuzzy_color(TG2, 3, return_alpha=True, fair=True))

Result: {5: 0, 6: 1, 1: 2, 7: 2, 2: 1, 3: 0, 4: 0, 8: 1} 0.9285714285714286 0.4

(Tuple of coloring, score [(1-DTI)], and alpha [of alpha-cut])

https://raw.githubusercontent.com/ferdinand-dhbw/fuzzy-graph-coloring/main/docs/images/colored-graph.png

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

  1. Get poetry https://python-poetry.org/docs/

  2. Make sure, Python 3.8 is being used

  3. poetry install in your system shell

  4. poetry 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

Metadata

Release files for fuzzy-graph-coloring 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fuzzy-graph-coloring 0.1.3
File Size Uploaded Provenance
fuzzy-graph-coloring-0.1.3.tar.gz 22.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fuzzy-graph-coloring 0.1.3
File Interpreter ABI Platform
fuzzy_graph_coloring-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 45.0 kB

Release files / fuzzy-graph-coloring-0.1.3.tar.gz

Download URL fuzzy-graph-coloring-0.1.3.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
66a004826035a57c9fd7e74a054f24296ad845da12e318631d9851bb4ea5ab02
BLAKE2b-256 checksum
How to use checksums
8c9ceb5fd2eed07004438be7ef237d727caa300e4e7491c6b9b724ff4c9252d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.8.8 Windows/10

Release files / fuzzy_graph_coloring-0.1.3-py3-none-any.whl

Download URL fuzzy_graph_coloring-0.1.3-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16dec94fa66282427204f2d131b4bbf5c6c0ee5d23d0dcd36dde41e9a26fa246
BLAKE2b-256 checksum
How to use checksums
e940e7ea8327ea9accd60ff5e7493ae14dc4c1b13eb90764e78ab66ced7d72de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.8.8 Windows/10

Security for fuzzy-graph-coloring 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page