⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edge.java

📁 java版的数据结构的完全代码 免费提供了 学习数据结构的请下载
💻 JAVA
字号:
// Introduced in Chapter 15/** An edge connecting two vertices in a graph. */public class Edge implements Comparable<Edge> {  /** Index of the destination vertex. */  private int dest;  /** Index of the source vertex. */  private int source;  /** Weight associated with this Edge. */  private double weight;  /** Store the given values. */  public Edge(int source, int dest, double weight) {    this.source = source;    this.dest = dest;    this.weight = weight;  }  public int compareTo(Edge that) {    if (weight > that.weight) {      return 1;    }    if (weight == that.weight) {      return 0;    }    return -1;  }  /** Return the destination vertex of this Edge. */  public int getDest() {    return dest;  }  /** Return the source vertex of this Edge. */  public int getSource() {    return source;  }  /** Return the weight of this Edge. */  public double getWeight() {    return weight;  }  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -