-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubconfig.go
More file actions
86 lines (72 loc) · 3.01 KB
/
subconfig.go
File metadata and controls
86 lines (72 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package algorithm
import "github.com/elecbug/netkit/graph"
// ClosenessCentralityConfig holds the configuration settings for the closeness centrality algorithm.
type ClosenessCentralityConfig struct {
Reverse bool
WfImproved bool
}
// PageRankConfig holds the configuration settings for the PageRank algorithm.
type PageRankConfig struct {
Alpha float64 // damping, default 0.85
MaxIter int // default 100
Tol float64 // L1 error, default 1e-6
Personalization *map[graph.NodeID]float64 // p(u); if nil is uniform
Dangling *map[graph.NodeID]float64 // d(u); if nil p(u)
Reverse bool
}
// BetweennessCentralityConfig holds the configuration settings for the edge betweenness centrality algorithm.
type BetweennessCentralityConfig struct {
Normalized bool
}
// EdgeBetweennessCentralityConfig holds the configuration settings for the edge betweenness centrality algorithm.
type EdgeBetweennessCentralityConfig struct {
Normalized bool
}
// EigenvectorCentralityConfig holds the configuration settings for the eigenvector centrality algorithm.
type EigenvectorCentralityConfig struct {
MaxIter int
Tol float64
Reverse bool
NStart *map[graph.NodeID]float64 // initial vector; if nil, uniform distribution
}
type DegreeCentralityMode string
const (
DegreeCentralityTotal DegreeCentralityMode = "total"
DegreeCentralityIn DegreeCentralityMode = "in"
DegreeCentralityOut DegreeCentralityMode = "out"
)
// DegreeCentralityConfig holds the configuration settings for the degree centrality algorithm.
type DegreeCentralityConfig struct {
Mode DegreeCentralityMode
}
// AssortativityMode defines how degree pairs (j,k) are taken on each edge/arc.
// - Projected: ignore direction; use undirected degrees on both ends.
// - OutIn: use out-degree(u) and in-degree(v) for each arc u->v
// - OutOut: out-degree(u) and out-degree(v)
// - InIn: in-degree(u) and in-degree(v)
// - InOut: in-degree(u) and out-degree(v)
type AssortativityMode string
const (
AssortativityProjected AssortativityMode = "projected"
AssortativityOutIn AssortativityMode = "out-in"
AssortativityOutOut AssortativityMode = "out-out"
AssortativityInIn AssortativityMode = "in-in"
AssortativityInOut AssortativityMode = "in-out"
)
// AssortativityCoefficientConfig holds the configuration settings for the assortativity coefficient algorithm.
type AssortativityCoefficientConfig struct {
// Mode selects which degree pairing to use.
// Defaults:
// - If graph is undirected: "projected"
// - If graph is directed: "out-in"
Mode AssortativityMode
// IgnoreSelfLoops controls whether to ignore self loops (u==v).
// Default: true
IgnoreSelfLoops bool
}
// ModularityConfig holds the configuration settings for the modularity calculation.
type ModularityConfig struct {
// Partition maps each node to its community ID.
// If nil, algorithm will compute greedy modularity communities automatically.
Partition map[graph.NodeID]int
}