MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / groupLink

Method groupLink

src/class197/Code01_Mafia1.java:92–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90
91 // 前后缀优化建图
92 public static void groupLink() {
93 if (gsiz > 1) {
94 cntt++;
95 addEdge(cntt, other(group[1]));
96 for (int i = 2; i <= gsiz; i++) {
97 cntt++;
98 addEdge(cntt, other(group[i]));
99 addEdge(group[i], cntt - 1);
100 addEdge(cntt, cntt - 1);
101 }
102 cntt++;
103 addEdge(cntt, other(group[gsiz]));
104 for (int i = gsiz - 1; i >= 1; i--) {
105 cntt++;
106 addEdge(cntt, other(group[i]));
107 addEdge(group[i], cntt - 1);
108 addEdge(cntt, cntt - 1);
109 }
110 }
111 }
112
113 public static void buildGraph(int limit) {
114 cntt = m << 1;

Callers 1

buildGraphMethod · 0.95

Calls 2

addEdgeMethod · 0.95
otherMethod · 0.95

Tested by

no test coverage detected