}
return new ClusterHead(g);
}
public static ClusterHead loadTreeFromDotS(String input) {
Graph g = new Graph();
String[] lines = input.split("\r\n|\r|\n");
HashMap<String, Node> nodes = new HashMap<String, Node>();
for (String line : lines) {
if (line.matches("^\\W*#.*$"))
continue;
Matcher m = definitionLine.matcher(line);
if (m.matches()) {
Matcher m2 = transitionLine.matcher(line);
if (m2.matches()) {
String s1 = m2.group(1);
String s2 = m2.group(2);
// String s3 = m2.group(3);
nodes.put(s1, new Node(s1));
nodes.put(s2, new Node(s2));
} else {
String s1 = m.group(1);
nodes.put(s1, new Node(s1));
}
} else {
}
}
for (String k : nodes.keySet()) {
g.addNode(nodes.get(k));
}
for (String line : lines) {
Matcher m2 = transitionLine.matcher(line);
if (m2.matches()) {