Skip to content

Commit a48a3c8

Browse files
Update README: v1.2, Python docs, release notes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 238f6aa commit a48a3c8

File tree

1 file changed

+94
-4
lines changed

1 file changed

+94
-4
lines changed

README.md

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
VieClus v1.1
1+
VieClus v1.2
22
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3+
[![PyPI](https://img.shields.io/pypi/v/vieclus)](https://pypi.org/project/vieclus/)
34
=====
45

56
The graph clustering framework VieClus -- Vienna Graph Clustering.
@@ -29,9 +30,6 @@ Moreover, while the previous best result for different instances has been comput
2930
width="538" height="468">
3031
</p>
3132

32-
## Main project site:
33-
http://vieclus.taa.univie.ac.at
34-
3533
Installation Notes
3634
=====
3735

@@ -58,6 +56,98 @@ Without MPI support:
5856

5957
For a description of the graph format please have a look into the manual.
6058

59+
Python Interface
60+
=====
61+
62+
You can install the Python interface via pip:
63+
``pip install vieclus``
64+
65+
Or build from source:
66+
``pip install .``
67+
68+
### Example: Using the vieclus_graph class
69+
70+
```python
71+
import vieclus
72+
73+
# Build a graph using the vieclus_graph helper class
74+
g = vieclus.vieclus_graph()
75+
g.set_num_nodes(6)
76+
77+
# Add edges (undirected, with weights)
78+
g.add_undirected_edge(0, 1, 5)
79+
g.add_undirected_edge(1, 2, 5)
80+
g.add_undirected_edge(0, 2, 5)
81+
g.add_undirected_edge(3, 4, 5)
82+
g.add_undirected_edge(4, 5, 5)
83+
g.add_undirected_edge(3, 5, 5)
84+
g.add_undirected_edge(2, 3, 1) # weak bridge between two communities
85+
86+
# Convert to CSR format and cluster
87+
vwgt, xadj, adjcwgt, adjncy = g.get_csr_arrays()
88+
modularity, clustering = vieclus.cluster(vwgt, xadj, adjcwgt, adjncy,
89+
mode=vieclus.STRONG, time_limit=1.0)
90+
91+
print(f"Modularity: {modularity}")
92+
print(f"Clustering: {clustering}")
93+
```
94+
95+
### Example: Using raw CSR arrays
96+
97+
```python
98+
import vieclus
99+
100+
# Graph in METIS CSR format (same as KaHIP)
101+
xadj = [0, 2, 5, 7, 9, 12]
102+
adjncy = [1, 4, 0, 2, 4, 1, 3, 2, 4, 0, 1, 3]
103+
vwgt = [1, 1, 1, 1, 1]
104+
adjcwgt = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
105+
106+
modularity, clustering = vieclus.cluster(vwgt, xadj, adjcwgt, adjncy,
107+
suppress_output=True,
108+
seed=0,
109+
mode=vieclus.ECO,
110+
time_limit=2.0)
111+
112+
print(f"Modularity: {modularity}")
113+
print(f"Clustering: {clustering}")
114+
```
115+
116+
### Parameters
117+
118+
The `vieclus.cluster` function takes the following arguments:
119+
120+
| Parameter | Type | Default | Description |
121+
|-----------|------|---------|-------------|
122+
| `vwgt` | list | *required* | Node weights (length n) |
123+
| `xadj` | list | *required* | CSR index array (length n+1) |
124+
| `adjcwgt` | list | *required* | Edge weights (length m) |
125+
| `adjncy` | list | *required* | CSR adjacency array (length m) |
126+
| `suppress_output` | bool | `True` | Suppress console output |
127+
| `seed` | int | `0` | Random seed |
128+
| `mode` | int | `STRONG` | Clustering mode: `vieclus.FAST`, `vieclus.ECO`, or `vieclus.STRONG` |
129+
| `time_limit` | float | `1.0` | Time limit in seconds |
130+
| `cluster_upperbound` | int | `0` | Max cluster size (0 = no limit) |
131+
132+
Returns a tuple `(modularity, clustering)` where `modularity` is a float in [-1, 1] and `clustering` is a list of cluster IDs for each node.
133+
134+
Release Notes
135+
=====
136+
137+
### v1.2
138+
- Added Python interface (`pip install vieclus`) with pybind11 bindings
139+
- Added `vieclus_graph` helper class for easy graph construction (same interface as KaHIP)
140+
- Added `vieclus.cluster()` function with FAST, ECO, and STRONG modes
141+
- Added PyPI packaging with scikit-build-core
142+
- Added GitHub Actions CI and automated PyPI publishing
143+
- Added NOMPI compilation support
144+
145+
### v1.1
146+
- Added cmake build system
147+
- Added option to compile without MPI support
148+
149+
### v1.0
150+
- Initial release of the memetic graph clustering algorithm
61151

62152
Licence
63153
=====

0 commit comments

Comments
 (0)