Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void FindEuler_H(Walk euler) {
- Euler G, G2;
- Walk C, C2;
- int randomVertex, circuitEdges;
- int[] matchingVertices;
- G = this; // For clarity
- C = new Walk(G.getTotalV());
- randomVertex = G.rand.nextInt(G.getTotalV);
- // Uses G2 instead of G for first C intialization because newCircuit alters Graph already
- G2 = (Euler)G.clone();
- circuitEdges += G2.newCircuit(firstVertex, G2.findConnectingVertex(firstVertex), C);
- C2 = (Walk)C.clone();
- while (circuitEdges == G.getTotalE() ) {
- // New circuit already changes edges/verties of G
- if (!G2.noVerticesLeft()) {// Still vertices left in matrix
- // finds vertex
- matchingVertices = G2.verticesInCommon(circit);
- randomVertex = matchingVertices[G2.rand.nextInt(matchingVertices.length)]; // Value at matchingVertices repersents vertice
- C2.clear();
- circuitEdges += G2.newCircuit(randomVertex, G2.findConnectingVertex(randomVertex), C2);
- C.insertCircuit(C2);
- }
- }
- return C;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement