Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void Get_dMins(StringTokenizer st, BufferedReader br) throws IOException {
- potentials = new LinkedList<>();
- int x, y, phi;
- for (int i = 0; i < P; i++) {
- st = new StringTokenizer(br.readLine(), " ");
- x = Integer.parseInt(st.nextToken())-1;
- y = Integer.parseInt(st.nextToken())-1;
- phi = Integer.parseInt(st.nextToken());
- potentials.add(graph[x][y]);
- graph[x][y].d_min = 0;
- graph[x][y].phi_min = phi;
- }
- Collections.sort(potentials, new VertexComparator());
- }
- private static void FillInVerticesNumbers() {
- while(!potentials.isEmpty()){
- Vertex act = potentials.pop();
- int phi = act.phi_min;
- int d = act.d_min +1;
- for(Edge e : act.edges){
- Vertex v = e.v1;
- if(v.equals(act)){
- v = e.v2;
- }
- if(v.d_min>d){
- v.phi_min = phi;
- v.d_min = d;
- potentials.add(v);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement