private void dfs() { init(); this.tempo = 0; List<Vertice> vertices = grafo.getVertices(); for (Vertice v : vertices) { if (v.getColor().equals(VerticeColor.WHITE)) { dfsVisit(v); } } }
public List<String> getConnectedComponents() { List<String> connectedComponents = new ArrayList<>(); List<Vertice> vertices = grafo.getVertices(); int currentTime = 1; Vertice initial = getVerticeByInitialTime(vertices, currentTime); while (initial != null) { connectedComponents.add(getConnectedComponent(vertices, initial)); initial = getVerticeByInitialTime(vertices, (initial.getFinalTime() + 1)); } return connectedComponents; }
public void printRoutingVector() { List<Vertice> vertices = grafo.getVertices(); String rotulos = ""; String fathers = ""; String time = ""; String temp = ""; for (Vertice v : vertices) { if (v.getFather() != null) { temp = v.getFather().getRotulo(); } else { temp = " "; } rotulos += v.getRotulo() + " | "; fathers += temp + " | "; time += String.valueOf(v.getInitialTime()) + "/" + String.valueOf(v.getFinalTime()) + " | "; } System.out.println(rotulos); System.out.println(fathers); System.out.println(time); }
private void init() { List<Vertice> vertices = grafo.getVertices(); for (Vertice v : vertices) { v.setColor(VerticeColor.WHITE); } }