@Override public Graph transform(Graph g) { System.err.println("This is not working completely yet, so don't expect good results!"); initIDSpace(g); /* * Phase 1 */ Node currentNode = null; List<Node> nodeList = Arrays.asList(g.getNodes()); List<Edge> removalList = new ArrayList<Edge>(); Collections.sort(nodeList, new NodeDegreeComparator()); for (int counter = 1; counter < (nodeList.size() - 3); counter++) { Boolean selectedANodeForThisIteration = false; if (currentNode != null) { // try to get a wave front / wave center node } if (!selectedANodeForThisIteration) { // We got no node yet - choose one with lowest degree currentNode = nodeList.get(0); } List<Edge> establishedEdges = getPairEdges(currentNode); } for (Node n : nodeList) System.out.println(n + " has degree " + n.getDegree()); // countAllCrossings(g); writeIDSpace(g); return g; }
@Override public int compare(Node n1, Node n2) { if (n1.getDegree() == n2.getDegree()) return 0; else if (n1.getDegree() > n2.getDegree()) return 1; else return -1; }