0_0_23319124_23522\Main.java:149: 错误: 需要class, interface或enum
public Graph(){
^
0_0_23319124_23522\Main.java:150: 错误: 需要class, interface或enum
static final int MAXNODE = 1000;
^
0_0_23319124_23522\Main.java:152: 错误: 需要class, interface或enum
{
^
0_0_23319124_23522\Main.java:154: 错误: 需要class, interface或enum
_color = new HashMap<String, Integer>();
^
0_0_23319124_23522\Main.java:155: 错误: 需要class, interface或enum
_weights = new HashMap<Set<String>, Double>();
^
0_0_23319124_23522\Main.java:156: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:163: 错误: 需要class, interface或enum
public void addEdge(String a, String b, double wt) {
^
0_0_23319124_23522\Main.java:169: 错误: 需要class, interface或enum
_adj.get(b).add(a);
^
0_0_23319124_23522\Main.java:172: 错误: 需要class, interface或enum
setWeight(a,b,wt);
^
0_0_23319124_23522\Main.java:173: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:180: 错误: 需要class, interface或enum
public void addNode(String a) {
^
0_0_23319124_23522\Main.java:183: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:194: 错误: 需要class, interface或enum
public void readGraph(String [][] entries, int numEntries) {
^
0_0_23319124_23522\Main.java:196: 错误: 需要class, interface或enum
for (int i = 0; i < numEntries; i++) {
^
0_0_23319124_23522\Main.java:196: 错误: 需要class, interface或enum
for (int i = 0; i < numEntries; i++) {
^
0_0_23319124_23522\Main.java:199: 错误: 需要class, interface或enum
addNode(node1);
^
0_0_23319124_23522\Main.java:200: 错误: 需要class, interface或enum
_color.put(node1, 1);
^
0_0_23319124_23522\Main.java:202: 错误: 需要class, interface或enum
int j = 1;
^
0_0_23319124_23522\Main.java:203: 错误: 需要class, interface或enum
while (entries[i][j] != null) {
^
0_0_23319124_23522\Main.java:205: 错误: 需要class, interface或enum
addNode(node2);
^
0_0_23319124_23522\Main.java:206: 错误: 需要class, interface或enum
addEdge(node1, node2, 1.0);
^
0_0_23319124_23522\Main.java:207: 错误: 需要class, interface或enum
j++;
^
0_0_23319124_23522\Main.java:208: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:214: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:222: 错误: 需要class, interface或enum
public int numVertices() {
^
0_0_23319124_23522\Main.java:224: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:230: 错误: 需要class, interface或enum
public int numEdges() {
^
0_0_23319124_23522\Main.java:232: 错误: 需要class, interface或enum
for (List<String> a : _adj.values()) {
^
0_0_23319124_23522\Main.java:234: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:236: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:242: 错误: 需要class, interface或enum
public int maxColor() {
^
0_0_23319124_23522\Main.java:244: 错误: 需要class, interface或enum
for(int c : _color.values()) {
^
0_0_23319124_23522\Main.java:246: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:248: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:255: 错误: 需要class, interface或enum
public int color(String u) {
^
0_0_23319124_23522\Main.java:257: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:265: 错误: 需要class, interface或enum
public void removeNode(String u) {
^
0_0_23319124_23522\Main.java:269: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:271: 错误: 需要class, interface或enum
_color.remove(u);
^
0_0_23319124_23522\Main.java:272: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:282: 错误: 需要class, interface或enum
public Map<Integer, Set<String>> getBFSLevels(String u) {
^
0_0_23319124_23522\Main.java:286: 错误: 需要class, interface或enum
Set<String> lev = new TreeSet<String>();
^
0_0_23319124_23522\Main.java:287: 错误: 需要class, interface或enum
lev.add(u);
^
0_0_23319124_23522\Main.java:288: 错误: 需要class, interface或enum
levels.put(0, lev);
^
0_0_23319124_23522\Main.java:289: 错误: 需要class, interface或enum
int i = 0;
^
0_0_23319124_23522\Main.java:290: 错误: 需要class, interface或enum
do {
^
0_0_23319124_23522\Main.java:292: 错误: 需要class, interface或enum
for (String v : levels.get(i)) {
^
0_0_23319124_23522\Main.java:294: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:298: 错误: 需要class, interface或enum
if(i > 0) lev.removeAll(levels.get(i-1));
^
0_0_23319124_23522\Main.java:301: 错误: 需要class, interface或enum
if(!lev.isEmpty()) levels.put(i+1, lev);
^
0_0_23319124_23522\Main.java:302: 错误: 需要class, interface或enum
i++;
^
0_0_23319124_23522\Main.java:304: 错误: 需要class, interface或enum
} while(!lev.isEmpty());
^
0_0_23319124_23522\Main.java:307: 错误: 需要class, interface或enum
return levels;
^
0_0_23319124_23522\Main.java:308: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:315: 错误: 需要class, interface或enum
public int degree(String u) {
^
0_0_23319124_23522\Main.java:317: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:323: 错误: 需要class, interface或enum
public Collection<String> vertices() {
^
0_0_23319124_23522\Main.java:325: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:332: 错误: 需要class, interface或enum
public Collection<String> getNeighbors(String u) {
^
0_0_23319124_23522\Main.java:334: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:339: 错误: 需要class, interface或enum
public Graph clone() {
^
0_0_23319124_23522\Main.java:341: 错误: 需要class, interface或enum
g._adj = new HashMap<String, List<String>>(_adj);
^
0_0_23319124_23522\Main.java:342: 错误: 需要class, interface或enum
for(String v : _adj.keySet()) {
^
0_0_23319124_23522\Main.java:344: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:346: 错误: 需要class, interface或enum
return g;
^
0_0_23319124_23522\Main.java:347: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:354: 错误: 需要class, interface或enum
public boolean contains(String u) {
^
0_0_23319124_23522\Main.java:356: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:364: 错误: 需要class, interface或enum
public double weight(String a, String b) {
^
0_0_23319124_23522\Main.java:366: 错误: 需要class, interface或enum
ab.add(a);
^
0_0_23319124_23522\Main.java:367: 错误: 需要class, interface或enum
ab.add(b);
^
0_0_23319124_23522\Main.java:368: 错误: 需要class, interface或enum
if(_weights.containsKey(ab)) {
^
0_0_23319124_23522\Main.java:370: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:372: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:374: 错误: 需要class, interface或enum
public double totalWeight() {
^
0_0_23319124_23522\Main.java:376: 错误: 需要class, interface或enum
for(double wt : _weights.values()) d += wt;
^
0_0_23319124_23522\Main.java:377: 错误: 需要class, interface或enum
return d;
^
0_0_23319124_23522\Main.java:378: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:380: 错误: 需要class, interface或enum
static public String solve(String [][] entries, int numEntries, String u) {
^
0_0_23319124_23522\Main.java:382: 错误: 需要class, interface或enum
g.readGraph(entries, numEntries);
^
0_0_23319124_23522\Main.java:384: 错误: 需要class, interface或enum
Map<Integer, Set<String>> levels = g.getBFSLevels(u);
^
0_0_23319124_23522\Main.java:385: 错误: 需要class, interface或enum
Set<String> Reachable = new TreeSet<String>();
^
0_0_23319124_23522\Main.java:387: 错误: 需要class, interface或enum
if (levels == null) return "";
^
0_0_23319124_23522\Main.java:389: 错误: 需要class, interface或enum
Reachable.addAll(levels.get(2));
^
0_0_23319124_23522\Main.java:392: 错误: 需要class, interface或enum
String result = "";
^
0_0_23319124_23522\Main.java:393: 错误: 需要class, interface或enum
for(String x : Reachable) {
^
0_0_23319124_23522\Main.java:395: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:397: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:406: 错误: 需要class, interface或enum
public void setWeight(String a, String b, double wt) {
^
0_0_23319124_23522\Main.java:408: 错误: 需要class, interface或enum
ab.add(a);
^
0_0_23319124_23522\Main.java:409: 错误: 需要class, interface或enum
ab.add(b);
^
0_0_23319124_23522\Main.java:410: 错误: 需要class, interface或enum
_weights.put(ab, wt);
^
0_0_23319124_23522\Main.java:411: 错误: 需要class, interface或enum
}
^
0_0_23319124_23522\Main.java:417: 错误: 需要class, interface或enum
private Map<String, Integer> _color;
^
0_0_23319124_23522\Main.java:420: 错误: 需要class, interface或enum
private Map<Set<String>, Double> _weights;
|