Skip to content

Commit 9a45d32

Browse files
authored
Merge pull request #44 from elecbug/elecbug/master
Update v0.12.5
2 parents 398d693 + 787bddb commit 9a45d32

2 files changed

Lines changed: 143 additions & 8 deletions

File tree

README.md

Lines changed: 143 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,166 @@
11
# Netkit
22

3-
Go (generic) graph algorithms and extensible libraries focused on clarity and performance.
3+
**Netkit** is a Go graph algorithm library focused on clarity, extensibility, and practical performance.
4+
5+
It provides reusable graph data structures and common network analysis algorithms, with selected results validated against [NetworkX](https://networkx.org/).
46

57
- Go 1.25+
68
- Module: `github.com/elecbug/netkit`
9+
- License: MIT
10+
11+
---
12+
13+
## Features
14+
15+
Netkit provides graph utilities and network analysis algorithms for both directed and undirected graphs.
16+
17+
Current focus areas include:
18+
19+
- Graph data structures
20+
- Shortest path analysis
21+
- Centrality metrics
22+
- Clustering metrics
23+
- Graph diameter
24+
- PageRank
25+
- Modularity analysis
26+
- NetworkX-compatible validation for selected algorithms
727

8-
## Install
28+
Implemented or planned algorithms include:
929

10-
```powershell
30+
- Degree centrality
31+
- Betweenness centrality
32+
- Edge betweenness centrality
33+
- Closeness centrality
34+
- Eigenvector centrality
35+
- PageRank
36+
- Clustering coefficient
37+
- Degree assortativity coefficient
38+
- Diameter / weighted diameter
39+
- Modularity
40+
41+
---
42+
43+
## Installation
44+
45+
```bash
1146
go get github.com/elecbug/netkit@latest
47+
````
48+
49+
---
50+
51+
## Usage
52+
53+
> [!NOTE]
54+
> Netkit is under active development. Public APIs may change before the first stable release.
55+
56+
```go
57+
package main
58+
59+
import (
60+
"fmt"
61+
62+
"github.com/elecbug/netkit/v2/analyzer"
63+
"github.com/elecbug/netkit/v2/graph"
64+
)
65+
66+
func main() {
67+
g := graph.NewGraph(false)
68+
69+
g.AddNode("0")
70+
g.AddNode("1")
71+
g.AddNode("2")
72+
73+
g.AddEdge("0", "1")
74+
g.AddEdge("1", "2")
75+
76+
a := analyzer.NewAnalyzer(g, nil)
77+
78+
degree, err := a.DegreeCentrality()
79+
if err != nil {
80+
panic(err)
81+
}
82+
83+
fmt.Println(degree)
84+
}
1285
```
1386
14-
<!-- ## Packages -->
87+
> API details may vary by version. See package documentation and examples for the latest usage.
88+
89+
---
90+
91+
## Validation
92+
93+
Netkit reimplements common graph and network algorithms in Go.
94+
95+
Where possible, algorithm outputs are validated against NetworkX to ensure correctness and compatibility of definitions.
96+
97+
Validation currently covers metrics such as:
98+
99+
* Degree centrality
100+
* Betweenness centrality
101+
* Edge betweenness centrality
102+
* Closeness centrality
103+
* Clustering coefficient
104+
* Degree assortativity coefficient
105+
* Diameter
106+
* Weighted diameter
107+
* Eigenvector centrality
108+
* PageRank
109+
* Shortest paths
110+
* Modularity
111+
112+
Some algorithms, especially greedy community detection for modularity, may not produce byte-for-byte identical results to NetworkX because heuristic merge order, tie-breaking, and implementation details can differ.
113+
114+
---
15115
16116
## Development
17117
18-
- Run tests
118+
Run all tests:
19119
20-
```powershell
120+
```bash
21121
go test ./...
22122
```
23123
124+
Run tests with verbose output:
125+
126+
```bash
127+
go test -v ./...
128+
```
129+
130+
Format code:
131+
132+
```bash
133+
gofmt -w .
134+
```
135+
136+
---
137+
138+
## Project Goals
139+
140+
Netkit is designed with the following goals:
141+
142+
1. **Clarity**
143+
Algorithms should be readable and easy to inspect.
144+
145+
2. **Extensibility**
146+
Graph structures and analysis components should be easy to extend.
147+
148+
3. **Practical performance**
149+
Implementations should be efficient enough for medium-to-large network analysis workloads.
150+
151+
4. **Validation**
152+
Results should be checked against established libraries such as NetworkX when possible.
153+
154+
---
155+
24156
## License
25157
26158
MIT © 2025 elecbug. See [`LICENSE`](./LICENSE).
27159
160+
---
161+
28162
## Credits
29163
30-
This project reimplements common network algorithms in Go with results validated against NetworkX.
31-
NetworkX is © the NetworkX Developers and distributed under the BSD 3-Clause License.
164+
This project reimplements common graph and network algorithms in Go with selected results validated against NetworkX.
165+
166+
NetworkX is © the NetworkX Developers and distributed under the BSD 3-Clause License.
File renamed without changes.

0 commit comments

Comments
 (0)