Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. private int newCircuit(int startV, int currentV, Walk circuit) {
  2. int lastVertex;
  3.  
  4. if (circuit.isCircuit()) { //need trivial? --- I'm sure circuits can connet to themself right?
  5. return circuit.getTotalV()-1;
  6. }
  7. if (circuit.isEmpty()) {
  8. circuit.addVertex(startV); //No changes I think since no edges removed?
  9. }
  10. //Pretty sure even if last iteration of startV and currentV, it's all the same
  11. else { //At least already one vertex in circuit, circuit.getTotalV() >= 1
  12. circuit.addVertex(currentV);
  13. lastVertex = circuit.getVertex((circuit.getTotalV()-1)-1); // Have to know the second last connection
  14. this.unvistedE[lastVertex][currentV]--; // Subtracts unvisited edge in adjacent matrix.
  15. this.unvistedE[currentV][lastVertex]--;
  16. this.unvistedDegreeV[currentV]--; // Current degree now goes down.
  17. // ??? How to find next vertex to go to? Possible for dead end? I don't think so.
  18. // It has to be a circuit, so no matter which connecting vertex we choose we can still go to it
  19. return newCircuit(startV,this.findConnectingVertex(currentV),circuit);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement