Skip to content

Commit

Permalink
Merge pull request #14 from MHenderson/12-remove-everything-except-fu…
Browse files Browse the repository at this point in the history
…nctions-needed-to-build-pythonconstraint-model

A fresh start.
  • Loading branch information
MHenderson authored Nov 25, 2024
2 parents 26e1c8e + 6d14e38 commit cf301c1
Show file tree
Hide file tree
Showing 12 changed files with 593 additions and 368 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**__pycache__
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
install:
poetry install

test:
poetry run pytest
559 changes: 558 additions & 1 deletion poetry.lock

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[tool.poetry]
name = "vizing"
version = "0.1.0"
description = "List-colouring in Python."
version = "0.1.0.9000"
description = "Constraint-based list-colouring in Python."
authors = ["Matthew Henderson <matthew.james.henderson@gmail.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
python-constraint = "^1.4.0"
networkx = "^3.2.1"
listcolouring = "^0.2.0"


[tool.poetry.group.test.dependencies]
Expand All @@ -19,7 +20,3 @@ networkx = "^3.2.1"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
pythonpath = [
"."
]
17 changes: 17 additions & 0 deletions src/vizing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import constraint

def list_colouring_problem(G):
P = constraint.Problem()
for node in G.nodes():
P.addVariable(node, G.nodes[node]['permissible'])
for edge in G.edges():
P.addConstraint(constraint.AllDifferentConstraint(), edge)
return(P)

def list_colouring_solution(G):
P = list_colouring_problem(G)
S = P.getSolution()
for node in S:
G.nodes[node]['colour'] = S[node]
return(G)

137 changes: 0 additions & 137 deletions src/vizing/colouring.py

This file was deleted.

51 changes: 0 additions & 51 deletions src/vizing/hall.py

This file was deleted.

49 changes: 0 additions & 49 deletions src/vizing/ortools.py

This file was deleted.

36 changes: 0 additions & 36 deletions src/vizing/pythonconstraint.py

This file was deleted.

Loading

0 comments on commit cf301c1

Please sign in to comment.