Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int newCircuit(int startV, int currentV, Walk circuit) {
- int lastVertex;
- if (circuit.isCircuit()) { //need trivial? --- I'm sure circuits can connet to themself right?
- return circuit.getTotalV()-1;
- }
- if (circuit.isEmpty()) {
- circuit.addVertex(startV); //No changes I think since no edges removed?
- }
- //Pretty sure even if last iteration of startV and currentV, it's all the same
- else { //At least already one vertex in circuit, circuit.getTotalV() >= 1
- circuit.addVertex(currentV);
- lastVertex = circuit.getVertex((circuit.getTotalV()-1)-1); // Have to know the second last connection
- this.unvistedE[lastVertex][currentV]--; // Subtracts unvisited edge in adjacent matrix.
- this.unvistedE[currentV][lastVertex]--;
- this.unvistedDegreeV[currentV]--; // Current degree now goes down.
- // ??? How to find next vertex to go to? Possible for dead end? I don't think so.
- // It has to be a circuit, so no matter which connecting vertex we choose we can still go to it
- return newCircuit(startV,this.findConnectingVertex(currentV),circuit);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement