furones 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- furones-0.0.1/LICENSE +21 -0
- furones-0.0.1/PKG-INFO +290 -0
- furones-0.0.1/README.md +250 -0
- furones-0.0.1/furones/__init__.py +4 -0
- furones-0.0.1/furones/algorithm.py +163 -0
- furones-0.0.1/furones/app.py +100 -0
- furones-0.0.1/furones/applogger.py +80 -0
- furones-0.0.1/furones/batch.py +53 -0
- furones-0.0.1/furones/parser.py +79 -0
- furones-0.0.1/furones/test.py +119 -0
- furones-0.0.1/furones/utils.py +231 -0
- furones-0.0.1/furones.egg-info/PKG-INFO +290 -0
- furones-0.0.1/furones.egg-info/SOURCES.txt +18 -0
- furones-0.0.1/furones.egg-info/dependency_links.txt +1 -0
- furones-0.0.1/furones.egg-info/entry_points.txt +4 -0
- furones-0.0.1/furones.egg-info/requires.txt +3 -0
- furones-0.0.1/furones.egg-info/top_level.txt +1 -0
- furones-0.0.1/pyproject.toml +26 -0
- furones-0.0.1/setup.cfg +4 -0
- furones-0.0.1/setup.py +53 -0
furones-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Frank Vega
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
furones-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: furones
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Compute the Approximate Independent Set for undirected graph encoded in DIMACS format.
|
|
5
|
+
Home-page: https://github.com/frankvegadelgado/furones
|
|
6
|
+
Author: Frank Vega
|
|
7
|
+
Author-email: vega.frank@gmail.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Project-URL: Source Code, https://github.com/frankvegadelgado/furones
|
|
10
|
+
Project-URL: Documentation Research, https://dev.to/frank_vega_987689489099bf/the-furones-algorithm-15lp
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering
|
|
12
|
+
Classifier: Topic :: Software Development
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: Education
|
|
19
|
+
Classifier: Intended Audience :: Information Technology
|
|
20
|
+
Classifier: Intended Audience :: Science/Research
|
|
21
|
+
Classifier: Natural Language :: English
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=2.2.1
|
|
26
|
+
Requires-Dist: scipy>=1.15.0
|
|
27
|
+
Requires-Dist: networkx[default]>=3.4.2
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: author-email
|
|
30
|
+
Dynamic: classifier
|
|
31
|
+
Dynamic: description
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: license
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
Dynamic: project-url
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: requires-python
|
|
39
|
+
Dynamic: summary
|
|
40
|
+
|
|
41
|
+
# Furones: Approximate Independent Set Solver
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
This work builds upon [A Sqrt(n)-Approximation for Independent Sets: The Furones Algorithm](https://dev.to/frank_vega_987689489099bf/the-furones-algorithm-15lp).
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
# Maximum Independent Set (MIS) Problem: Overview
|
|
50
|
+
|
|
51
|
+
## Definition
|
|
52
|
+
|
|
53
|
+
The **Maximum Independent Set (MIS)** problem is a fundamental NP-hard problem in graph theory. Given an undirected graph $G = (V, E)$, an _independent set_ is a subset of vertices $S \subseteq V$ where no two vertices in $S$ are adjacent. The MIS problem seeks the largest such subset $S$.
|
|
54
|
+
|
|
55
|
+
## Key Properties
|
|
56
|
+
|
|
57
|
+
- **NP-Hardness**: MIS is computationally intractable (no known polynomial-time solution unless $P = NP$).
|
|
58
|
+
- **Equivalent Problems**:
|
|
59
|
+
- MIS is equivalent to finding the largest _clique_ in the complement graph $\overline{G}$.
|
|
60
|
+
- It is also related to the _Minimum Vertex Cover_ problem: $S$ is an MIS iff $V \setminus S$ is a vertex cover.
|
|
61
|
+
|
|
62
|
+
## Applications
|
|
63
|
+
|
|
64
|
+
1. **Scheduling**: Assigning non-conflicting tasks (e.g., scheduling exams with no shared students).
|
|
65
|
+
2. **Network Design**: Selecting non-adjacent nodes for efficient resource allocation.
|
|
66
|
+
3. **Bioinformatics**: Modeling protein-protein interaction networks.
|
|
67
|
+
|
|
68
|
+
## Algorithms
|
|
69
|
+
|
|
70
|
+
| Approach | Description | Complexity |
|
|
71
|
+
| ------------------- | ---------------------------------------------------------------------- | ------------------- |
|
|
72
|
+
| Brute-Force | Checks all possible subsets of vertices. | $O(2^n)$ |
|
|
73
|
+
| Greedy Heuristics | Selects vertices with minimal degree iteratively. | $O(n + m)$ (approx) |
|
|
74
|
+
| Dynamic Programming | Used for trees or graphs with bounded treewidth. | $O(3^{tw})$ |
|
|
75
|
+
| Approximation | No PTAS exists; best-known approximation ratio is $O(n / (\log n)^2)$. | NP-Hard |
|
|
76
|
+
|
|
77
|
+
## Example
|
|
78
|
+
|
|
79
|
+
For a graph with vertices $\{A, B, C\}$ and edges $\{(A,B), (B,C)\}$:
|
|
80
|
+
|
|
81
|
+
- **Independent Sets**: $\{A, C\}$, $\{A\}$, $\{B\}$, $\{C\}$.
|
|
82
|
+
- **MIS**: $\{A, C\}$ (size 2).
|
|
83
|
+
|
|
84
|
+
## Open Challenges
|
|
85
|
+
|
|
86
|
+
- Finding a constant-factor approximation for general graphs.
|
|
87
|
+
- Efficient quantum or parallel algorithms for large-scale graphs.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Problem Statement
|
|
92
|
+
|
|
93
|
+
Input: A Boolean Adjacency Matrix $M$.
|
|
94
|
+
|
|
95
|
+
Answer: Find a Maximum Independent Set.
|
|
96
|
+
|
|
97
|
+
### Example Instance: 5 x 5 matrix
|
|
98
|
+
|
|
99
|
+
| | c1 | c2 | c3 | c4 | c5 |
|
|
100
|
+
| ------ | --- | --- | --- | --- | --- |
|
|
101
|
+
| **r1** | 0 | 0 | 1 | 0 | 1 |
|
|
102
|
+
| **r2** | 0 | 0 | 0 | 1 | 0 |
|
|
103
|
+
| **r3** | 1 | 0 | 0 | 0 | 1 |
|
|
104
|
+
| **r4** | 0 | 1 | 0 | 0 | 0 |
|
|
105
|
+
| **r5** | 1 | 0 | 1 | 0 | 0 |
|
|
106
|
+
|
|
107
|
+
The input for undirected graph is typically provided in [DIMACS](http://dimacs.rutgers.edu/Challenges) format. In this way, the previous adjacency matrix is represented in a text file using the following string representation:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
p edge 5 4
|
|
111
|
+
e 1 3
|
|
112
|
+
e 1 5
|
|
113
|
+
e 2 4
|
|
114
|
+
e 3 5
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
This represents a 5x5 matrix in DIMACS format such that each edge $(v,w)$ appears exactly once in the input file and is not repeated as $(w,v)$. In this format, every edge appears in the form of
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
e W V
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
where the fields W and V specify the endpoints of the edge while the lower-case character `e` signifies that this is an edge descriptor line.
|
|
124
|
+
|
|
125
|
+
_Example Solution:_
|
|
126
|
+
|
|
127
|
+
Independent Set Found `4, 5`: Nodes `4`, and `5` constitute an optimal solution.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
# Compile and Environment
|
|
132
|
+
|
|
133
|
+
## Prerequisites
|
|
134
|
+
|
|
135
|
+
- Python ≥ 3.10
|
|
136
|
+
|
|
137
|
+
## Installation
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install furones
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Execution
|
|
144
|
+
|
|
145
|
+
1. Clone the repository:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
git clone https://github.com/frankvegadelgado/furones.git
|
|
149
|
+
cd furones
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
2. Run the script:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
asia -i ./benchmarks/testMatrix1
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
utilizing the `asia` command provided by Furones's Library to execute the Boolean adjacency matrix `furones\benchmarks\testMatrix1`. The file `testMatrix1` represents the example described herein. We also support `.xz`, `.lzma`, `.bz2`, and `.bzip2` compressed text files.
|
|
159
|
+
|
|
160
|
+
**Example Output:**
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
testMatrix1: Independent Set Found 4, 5
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
This indicates nodes `4, 5` form a Independent Set.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Independent Set Size
|
|
171
|
+
|
|
172
|
+
Use the `-c` flag to count the nodes in the Independent Set:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
asia -i ./benchmarks/testMatrix2 -c
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Output:**
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
testMatrix2: Independent Set Size 5
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
# Command Options
|
|
187
|
+
|
|
188
|
+
Display help and options:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
asia -h
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Output:**
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
usage: asia [-h] -i INPUTFILE [-a] [-b] [-c] [-v] [-l] [--version]
|
|
198
|
+
|
|
199
|
+
Compute the Approximate Independent Set for undirected graph encoded in DIMACS format.
|
|
200
|
+
|
|
201
|
+
options:
|
|
202
|
+
-h, --help show this help message and exit
|
|
203
|
+
-i INPUTFILE, --inputFile INPUTFILE
|
|
204
|
+
input file path
|
|
205
|
+
-a, --approximation enable comparison with a polynomial-time approximation approach within a factor of at most 2
|
|
206
|
+
-b, --bruteForce enable comparison with the exponential-time brute-force approach
|
|
207
|
+
-c, --count calculate the size of the Independent Set
|
|
208
|
+
-v, --verbose anable verbose output
|
|
209
|
+
-l, --log enable file logging
|
|
210
|
+
--version show program's version number and exit
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
# Batch Execution
|
|
216
|
+
|
|
217
|
+
Batch execution allows you to solve multiple graphs within a directory consecutively.
|
|
218
|
+
|
|
219
|
+
To view available command-line options for the `batch_asia` command, use the following in your terminal or command prompt:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
batch_asia -h
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
This will display the following help information:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
usage: batch_asia [-h] -i INPUTDIRECTORY [-a] [-b] [-c] [-v] [-l] [--version]
|
|
229
|
+
|
|
230
|
+
Compute the Approximate Independent Set for all undirected graphs encoded in DIMACS format and stored in a directory.
|
|
231
|
+
|
|
232
|
+
options:
|
|
233
|
+
-h, --help show this help message and exit
|
|
234
|
+
-i INPUTDIRECTORY, --inputDirectory INPUTDIRECTORY
|
|
235
|
+
Input directory path
|
|
236
|
+
-a, --approximation enable comparison with a polynomial-time approximation approach within a factor of at most 2
|
|
237
|
+
-b, --bruteForce enable comparison with the exponential-time brute-force approach
|
|
238
|
+
-c, --count calculate the size of the Independent Set
|
|
239
|
+
-v, --verbose anable verbose output
|
|
240
|
+
-l, --log enable file logging
|
|
241
|
+
--version show program's version number and exit
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
# Testing Application
|
|
247
|
+
|
|
248
|
+
A command-line utility named `test_asia` is provided for evaluating the Algorithm using randomly generated, large sparse matrices. It supports the following options:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
usage: test_asia [-h] -d DIMENSION [-n NUM_TESTS] [-s SPARSITY] [-a] [-b] [-c] [-w] [-v] [-l] [--version]
|
|
252
|
+
|
|
253
|
+
The Furones Testing Application using randomly generated, large sparse matrices.
|
|
254
|
+
|
|
255
|
+
options:
|
|
256
|
+
-h, --help show this help message and exit
|
|
257
|
+
-d DIMENSION, --dimension DIMENSION
|
|
258
|
+
an integer specifying the dimensions of the square matrices
|
|
259
|
+
-n NUM_TESTS, --num_tests NUM_TESTS
|
|
260
|
+
an integer specifying the number of tests to run
|
|
261
|
+
-s SPARSITY, --sparsity SPARSITY
|
|
262
|
+
sparsity of the matrices (0.0 for dense, close to 1.0 for very sparse)
|
|
263
|
+
-a, --approximation enable comparison with a polynomial-time approximation approach within a factor of at most 2
|
|
264
|
+
-b, --bruteForce enable comparison with the exponential-time brute-force approach
|
|
265
|
+
-c, --count calculate the size of the Independent Set
|
|
266
|
+
-w, --write write the generated random matrix to a file in the current directory
|
|
267
|
+
-v, --verbose anable verbose output
|
|
268
|
+
-l, --log enable file logging
|
|
269
|
+
--version show program's version number and exit
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
# Code
|
|
275
|
+
|
|
276
|
+
- Python implementation by **Frank Vega**.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
# Complexity
|
|
281
|
+
|
|
282
|
+
```diff
|
|
283
|
+
+ We present a polynomial-time algorithm achieving a Sqrt(n)-approximation ratio for MIS, providing strong evidence that P = NP by efficiently solving a computationally hard problem with near-optimal solutions.
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
# License
|
|
289
|
+
|
|
290
|
+
- MIT License.
|
furones-0.0.1/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Furones: Approximate Independent Set Solver
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
This work builds upon [A Sqrt(n)-Approximation for Independent Sets: The Furones Algorithm](https://dev.to/frank_vega_987689489099bf/the-furones-algorithm-15lp).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Maximum Independent Set (MIS) Problem: Overview
|
|
10
|
+
|
|
11
|
+
## Definition
|
|
12
|
+
|
|
13
|
+
The **Maximum Independent Set (MIS)** problem is a fundamental NP-hard problem in graph theory. Given an undirected graph $G = (V, E)$, an _independent set_ is a subset of vertices $S \subseteq V$ where no two vertices in $S$ are adjacent. The MIS problem seeks the largest such subset $S$.
|
|
14
|
+
|
|
15
|
+
## Key Properties
|
|
16
|
+
|
|
17
|
+
- **NP-Hardness**: MIS is computationally intractable (no known polynomial-time solution unless $P = NP$).
|
|
18
|
+
- **Equivalent Problems**:
|
|
19
|
+
- MIS is equivalent to finding the largest _clique_ in the complement graph $\overline{G}$.
|
|
20
|
+
- It is also related to the _Minimum Vertex Cover_ problem: $S$ is an MIS iff $V \setminus S$ is a vertex cover.
|
|
21
|
+
|
|
22
|
+
## Applications
|
|
23
|
+
|
|
24
|
+
1. **Scheduling**: Assigning non-conflicting tasks (e.g., scheduling exams with no shared students).
|
|
25
|
+
2. **Network Design**: Selecting non-adjacent nodes for efficient resource allocation.
|
|
26
|
+
3. **Bioinformatics**: Modeling protein-protein interaction networks.
|
|
27
|
+
|
|
28
|
+
## Algorithms
|
|
29
|
+
|
|
30
|
+
| Approach | Description | Complexity |
|
|
31
|
+
| ------------------- | ---------------------------------------------------------------------- | ------------------- |
|
|
32
|
+
| Brute-Force | Checks all possible subsets of vertices. | $O(2^n)$ |
|
|
33
|
+
| Greedy Heuristics | Selects vertices with minimal degree iteratively. | $O(n + m)$ (approx) |
|
|
34
|
+
| Dynamic Programming | Used for trees or graphs with bounded treewidth. | $O(3^{tw})$ |
|
|
35
|
+
| Approximation | No PTAS exists; best-known approximation ratio is $O(n / (\log n)^2)$. | NP-Hard |
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
For a graph with vertices $\{A, B, C\}$ and edges $\{(A,B), (B,C)\}$:
|
|
40
|
+
|
|
41
|
+
- **Independent Sets**: $\{A, C\}$, $\{A\}$, $\{B\}$, $\{C\}$.
|
|
42
|
+
- **MIS**: $\{A, C\}$ (size 2).
|
|
43
|
+
|
|
44
|
+
## Open Challenges
|
|
45
|
+
|
|
46
|
+
- Finding a constant-factor approximation for general graphs.
|
|
47
|
+
- Efficient quantum or parallel algorithms for large-scale graphs.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Problem Statement
|
|
52
|
+
|
|
53
|
+
Input: A Boolean Adjacency Matrix $M$.
|
|
54
|
+
|
|
55
|
+
Answer: Find a Maximum Independent Set.
|
|
56
|
+
|
|
57
|
+
### Example Instance: 5 x 5 matrix
|
|
58
|
+
|
|
59
|
+
| | c1 | c2 | c3 | c4 | c5 |
|
|
60
|
+
| ------ | --- | --- | --- | --- | --- |
|
|
61
|
+
| **r1** | 0 | 0 | 1 | 0 | 1 |
|
|
62
|
+
| **r2** | 0 | 0 | 0 | 1 | 0 |
|
|
63
|
+
| **r3** | 1 | 0 | 0 | 0 | 1 |
|
|
64
|
+
| **r4** | 0 | 1 | 0 | 0 | 0 |
|
|
65
|
+
| **r5** | 1 | 0 | 1 | 0 | 0 |
|
|
66
|
+
|
|
67
|
+
The input for undirected graph is typically provided in [DIMACS](http://dimacs.rutgers.edu/Challenges) format. In this way, the previous adjacency matrix is represented in a text file using the following string representation:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
p edge 5 4
|
|
71
|
+
e 1 3
|
|
72
|
+
e 1 5
|
|
73
|
+
e 2 4
|
|
74
|
+
e 3 5
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This represents a 5x5 matrix in DIMACS format such that each edge $(v,w)$ appears exactly once in the input file and is not repeated as $(w,v)$. In this format, every edge appears in the form of
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
e W V
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
where the fields W and V specify the endpoints of the edge while the lower-case character `e` signifies that this is an edge descriptor line.
|
|
84
|
+
|
|
85
|
+
_Example Solution:_
|
|
86
|
+
|
|
87
|
+
Independent Set Found `4, 5`: Nodes `4`, and `5` constitute an optimal solution.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
# Compile and Environment
|
|
92
|
+
|
|
93
|
+
## Prerequisites
|
|
94
|
+
|
|
95
|
+
- Python ≥ 3.10
|
|
96
|
+
|
|
97
|
+
## Installation
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install furones
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Execution
|
|
104
|
+
|
|
105
|
+
1. Clone the repository:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git clone https://github.com/frankvegadelgado/furones.git
|
|
109
|
+
cd furones
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
2. Run the script:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
asia -i ./benchmarks/testMatrix1
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
utilizing the `asia` command provided by Furones's Library to execute the Boolean adjacency matrix `furones\benchmarks\testMatrix1`. The file `testMatrix1` represents the example described herein. We also support `.xz`, `.lzma`, `.bz2`, and `.bzip2` compressed text files.
|
|
119
|
+
|
|
120
|
+
**Example Output:**
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
testMatrix1: Independent Set Found 4, 5
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This indicates nodes `4, 5` form a Independent Set.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Independent Set Size
|
|
131
|
+
|
|
132
|
+
Use the `-c` flag to count the nodes in the Independent Set:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
asia -i ./benchmarks/testMatrix2 -c
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Output:**
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
testMatrix2: Independent Set Size 5
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
# Command Options
|
|
147
|
+
|
|
148
|
+
Display help and options:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
asia -h
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Output:**
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
usage: asia [-h] -i INPUTFILE [-a] [-b] [-c] [-v] [-l] [--version]
|
|
158
|
+
|
|
159
|
+
Compute the Approximate Independent Set for undirected graph encoded in DIMACS format.
|
|
160
|
+
|
|
161
|
+
options:
|
|
162
|
+
-h, --help show this help message and exit
|
|
163
|
+
-i INPUTFILE, --inputFile INPUTFILE
|
|
164
|
+
input file path
|
|
165
|
+
-a, --approximation enable comparison with a polynomial-time approximation approach within a factor of at most 2
|
|
166
|
+
-b, --bruteForce enable comparison with the exponential-time brute-force approach
|
|
167
|
+
-c, --count calculate the size of the Independent Set
|
|
168
|
+
-v, --verbose anable verbose output
|
|
169
|
+
-l, --log enable file logging
|
|
170
|
+
--version show program's version number and exit
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
# Batch Execution
|
|
176
|
+
|
|
177
|
+
Batch execution allows you to solve multiple graphs within a directory consecutively.
|
|
178
|
+
|
|
179
|
+
To view available command-line options for the `batch_asia` command, use the following in your terminal or command prompt:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
batch_asia -h
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
This will display the following help information:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
usage: batch_asia [-h] -i INPUTDIRECTORY [-a] [-b] [-c] [-v] [-l] [--version]
|
|
189
|
+
|
|
190
|
+
Compute the Approximate Independent Set for all undirected graphs encoded in DIMACS format and stored in a directory.
|
|
191
|
+
|
|
192
|
+
options:
|
|
193
|
+
-h, --help show this help message and exit
|
|
194
|
+
-i INPUTDIRECTORY, --inputDirectory INPUTDIRECTORY
|
|
195
|
+
Input directory path
|
|
196
|
+
-a, --approximation enable comparison with a polynomial-time approximation approach within a factor of at most 2
|
|
197
|
+
-b, --bruteForce enable comparison with the exponential-time brute-force approach
|
|
198
|
+
-c, --count calculate the size of the Independent Set
|
|
199
|
+
-v, --verbose anable verbose output
|
|
200
|
+
-l, --log enable file logging
|
|
201
|
+
--version show program's version number and exit
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
# Testing Application
|
|
207
|
+
|
|
208
|
+
A command-line utility named `test_asia` is provided for evaluating the Algorithm using randomly generated, large sparse matrices. It supports the following options:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
usage: test_asia [-h] -d DIMENSION [-n NUM_TESTS] [-s SPARSITY] [-a] [-b] [-c] [-w] [-v] [-l] [--version]
|
|
212
|
+
|
|
213
|
+
The Furones Testing Application using randomly generated, large sparse matrices.
|
|
214
|
+
|
|
215
|
+
options:
|
|
216
|
+
-h, --help show this help message and exit
|
|
217
|
+
-d DIMENSION, --dimension DIMENSION
|
|
218
|
+
an integer specifying the dimensions of the square matrices
|
|
219
|
+
-n NUM_TESTS, --num_tests NUM_TESTS
|
|
220
|
+
an integer specifying the number of tests to run
|
|
221
|
+
-s SPARSITY, --sparsity SPARSITY
|
|
222
|
+
sparsity of the matrices (0.0 for dense, close to 1.0 for very sparse)
|
|
223
|
+
-a, --approximation enable comparison with a polynomial-time approximation approach within a factor of at most 2
|
|
224
|
+
-b, --bruteForce enable comparison with the exponential-time brute-force approach
|
|
225
|
+
-c, --count calculate the size of the Independent Set
|
|
226
|
+
-w, --write write the generated random matrix to a file in the current directory
|
|
227
|
+
-v, --verbose anable verbose output
|
|
228
|
+
-l, --log enable file logging
|
|
229
|
+
--version show program's version number and exit
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
# Code
|
|
235
|
+
|
|
236
|
+
- Python implementation by **Frank Vega**.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
# Complexity
|
|
241
|
+
|
|
242
|
+
```diff
|
|
243
|
+
+ We present a polynomial-time algorithm achieving a Sqrt(n)-approximation ratio for MIS, providing strong evidence that P = NP by efficiently solving a computationally hard problem with near-optimal solutions.
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
# License
|
|
249
|
+
|
|
250
|
+
- MIT License.
|