forked from soniakeys/graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prop.go
186 lines (167 loc) · 4.16 KB
/
prop.go
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// Copyright 2017 Sonia Keys
// License MIT: http://opensource.org/licenses/MIT
package main
import (
"github.com/soniakeys/graph"
"github.com/soniakeys/graph/alt"
)
var chungLuSmallCCRep graph.NI
var chungLuSmallCCma int
var chungLuSmallCCTag string
func CCSmall() (string, string) {
reps, orders, ma := chungLuSmall.ConnectedComponentReps()
max := 0
for i, o := range orders {
if o > max {
max = o
chungLuSmallCCRep = reps[i]
chungLuSmallCCma = ma[i]
}
}
chungLuSmallCCTag = "ChungLu giant component " + h(max) + " nds"
return "Connected Components", chungLuSmallTag
}
var chungLuLargeCCRep graph.NI
var chungLuLargeCCma int
var chungLuLargeCCTag string
func CCLarge() (string, string) {
reps, orders, ma := chungLuLarge.ConnectedComponentReps()
max := 0
for i, o := range orders {
if o > max {
max = o
chungLuLargeCCRep = reps[i]
chungLuLargeCCma = ma[i]
}
}
chungLuLargeCCTag = "ChungLu giant component " + h(max) + " nds"
return "Connected Components", chungLuLargeTag
}
var eucSmallSCCRep graph.NI
var eucSmallSCCTag string
func SCCEucSmall() (string, string) {
max := 0
eucSmall.StronglyConnectedComponents(func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
eucSmallSCCRep = c[0]
}
return true
})
eucSmallSCCTag = "Euclidean giant component " + h(max) + " nds"
return "SCC (Pearce)", eucSmallTag
}
var eucLargeSCCRep graph.NI
var eucLargeSCCTag string
func SCCEucLarge() (string, string) {
max := 0
eucLarge.StronglyConnectedComponents(func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
eucLargeSCCRep = c[0]
}
return true
})
eucLargeSCCTag = "Euclidean giant component " + h(max) + " nds"
return "SCC (Pearce)", eucLargeTag
}
var kronDSmallSCCRep graph.NI
var kronDSmallSCCTag string
func SCCPearceSmall() (string, string) {
max := 0
kronDSmall.StronglyConnectedComponents(func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDSmallSCCRep = c[0]
}
return true
})
kronDSmallSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC (Pearce)", kronDSmallTag
}
func SCCPearceLarge() (string, string) {
max := 0
kronDLarge.StronglyConnectedComponents(func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDLargeSCCRep = c[0]
}
return true
})
kronDLargeSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC (Pearce)", kronDLargeTag
}
func SCCPathSmall() (string, string) {
max := 0
alt.SCCPathBased(kronDSmall, func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDSmallSCCRep = c[0]
}
return true
})
kronDSmallSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC path based", kronDSmallTag
}
var kronDLargeSCCRep graph.NI
var kronDLargeSCCTag string
func SCCPathLarge() (string, string) {
max := 0
alt.SCCPathBased(kronDLarge, func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDLargeSCCRep = c[0]
}
return true
})
kronDLargeSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC path based", kronDLargeTag
}
func SCCTarjanSmall() (string, string) {
max := 0
alt.SCCTarjan(kronDSmall, func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDSmallSCCRep = c[0]
}
return true
})
kronDSmallSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC Tarjan", kronDSmallTag
}
func SCCTarjanLarge() (string, string) {
max := 0
alt.SCCTarjan(kronDLarge, func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDLargeSCCRep = c[0]
}
return true
})
kronDLargeSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC Tarjan", kronDLargeTag
}
func SCCKosarajuSmall() (string, string) {
max := 0
alt.SCCKosaraju(kronDSmall, func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDSmallSCCRep = c[0]
}
return true
})
kronDSmallSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC Kosaraju", kronDSmallTag
}
func SCCKosarajuLarge() (string, string) {
max := 0
alt.SCCKosaraju(kronDLarge, func(c []graph.NI) bool {
if len(c) > max {
max = len(c)
kronDLargeSCCRep = c[0]
}
return true
})
kronDLargeSCCTag = "Kronecker giant component " + h(max) + " nds"
return "SCC Kosaraju", kronDLargeTag
}