package com.hnu.globalPath;
import java.util.*;
public class DijSuccess {
public static int INFINITY = 99999;
public static Map<String, Vertex> vertexMap = new HashMap<String, Vertex>();
//边距
public static class Edge {
public Vertex dest;
public double cost;
public Edge(Vertex d, double c) {
this.dest = d;
this.cost = c;
}
}
//静态类:Vertex
public static class Vertex implements Comparable<Vertex> {
public String name;
public List<Edge> adj;
public double dist;
public Vertex prev;
public int scratch;
public boolean visited;
public Vertex(String nm) {
this.name = nm;
adj = new ArrayList<Edge>();
reset();
}
public void reset() {
visited = false;
dist = DijSuccess.INFINITY;
}
有向图最短路径算法(dijkstra)
最新推荐文章于 2024-06-03 20:20:46 发布