网络图的公平着色。
equitable-coloring的Python项目详细描述
networkX图的公平着色。
来自Wikipedia:
In graph theory [..] an equitable coloring is an assignment of colors to the vertices of an undirected graph, in such a way that
- No two adjacent vertices have the same color, and
- The numbers of vertices in any two color classes differ by at most one.
Kierstead et. al.提供了一个快速多项式时间算法,用于利用最大{^ Tt2} $的图,利用^ {Tt1}颜色来揭示一个均匀着色。 这个包是networkx图算法的一个实现。
- 自由软件:麻省理工学院许可证
安装
pip install equitable-coloring
用法
使用equitable-coloring:
>>> import networkx as nx >>> from equitable_coloring import equitable_color >>> from equitable_coloring.utils import is_equitable >>> G = nx.cycle_graph(4) >>> d = equitable_color(G, num_colors=3) >>> is_equitable(G, d) True
开发
要运行所有测试,请运行:
pip install pytest-cov # Needed the first time. python setup.py test
或者,您可以使用tox。
更改日志
0.1.2(2018-06-30)
- 更新自述文件和使用说明。
0.1.1(2018-06-30)
- 带有测试的初始版本。
0.1.0(2018-06-11)
- 第一次承诺。