RRD - Add burning_number and vertex_clique_cover_number#24
Conversation
…ning number tests
burning_number and vertex_clique_cover_number
There was a problem hiding this comment.
Pull Request Overview
This PR adds two new graph invariants to the graphcalc library: the burning number and the vertex clique cover number. The burning number represents the minimum number of rounds needed to "burn" all vertices in a graph through a spreading process, while the vertex clique cover number determines the minimum number of cliques needed to partition all vertices.
- Added burning number computation using Mixed Integer Programming with comprehensive test coverage
- Added vertex clique cover number computation using the complement graph's chromatic number
- Updated data generation to include both new invariants in knowledge tables
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/test_burning_number.py | Comprehensive test suite for burning number on various graph families |
| src/graphcalc/invariants/zero_forcing.py | Implementation of burning number using MIP with utilities and solver integration |
| src/graphcalc/invariants/classics.py | Implementation of vertex clique cover functions and minor fix to coloring constraints |
| src/graphcalc/data/data_generation.py | Added new invariants to the list of computed properties |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| from typing import Dict, Hashable, List, Optional, Tuple | ||
| import itertools | ||
| import math | ||
|
|
||
|
|
||
|
|
||
| from typing import Union, Set, List, Hashable |
There was a problem hiding this comment.
Duplicate imports and inconsistent import organization. Lines 2-5 import typing components that are then re-imported on line 9. The typing imports should be consolidated into a single import statement.
| from typing import Dict, Hashable, List, Optional, Tuple | |
| import itertools | |
| import math | |
| from typing import Union, Set, List, Hashable | |
| from typing import Dict, Hashable, List, Optional, Tuple, Union, Set | |
| import itertools | |
| import math |
| from graphcalc.utils import enforce_type, GraphLike | ||
| from graphcalc.core import SimpleGraph |
There was a problem hiding this comment.
SimpleGraph is imported twice - once from graphcalc on line 16 and again from graphcalc.core on line 18. This creates redundant imports and potential confusion.
| from graphcalc.utils import enforce_type, GraphLike | |
| from graphcalc.core import SimpleGraph |
| """Shortest-path distances; disconnected pairs get +inf.""" | ||
| dist: Dict[Hashable, Dict[Hashable, int]] = { | ||
| u: {v: (0 if u == v else math.inf) for v in G.nodes()} for u in G.nodes() |
There was a problem hiding this comment.
Using math.inf for disconnected pairs is inefficient as it creates float objects. Since these distances are later compared with integers, consider using a large integer constant instead, or handle disconnected pairs separately to avoid unnecessary float comparisons.
| """Shortest-path distances; disconnected pairs get +inf.""" | |
| dist: Dict[Hashable, Dict[Hashable, int]] = { | |
| u: {v: (0 if u == v else math.inf) for v in G.nodes()} for u in G.nodes() | |
| """Shortest-path distances; disconnected pairs get a large integer value.""" | |
| LARGE_INT = 10**9 | |
| dist: Dict[Hashable, Dict[Hashable, int]] = { | |
| u: {v: (0 if u == v else LARGE_INT) for v in G.nodes()} for u in G.nodes() |
| @@ -1,4 +1,4 @@ | |||
| from typing import Set, Hashable, Dict, Tuple, Hashable | |||
| from typing import Set, Hashable, Dict, Tuple, Hashable, List | |||
There was a problem hiding this comment.
The type Hashable is imported twice in the same import statement. Remove the duplicate import.
| from typing import Set, Hashable, Dict, Tuple, Hashable, List | |
| from typing import Set, Hashable, Dict, Tuple, List |
No description provided.