-
大小: 3.85MB文件类型: .rar金币: 2下载: 0 次发布日期: 2023-10-01
- 语言: Java
- 标签: ntroduction to Java Programming
资源简介
Introduction to Java Programming第八版的原码+习题代码,作者Y.daniel Liang

代码片段和文件信息
import java.util.*;
public abstract class AbstractGraph implements Graph {
protected List vertices; // Store vertices
protected List> neighbors; // Adjacency lists
/** Construct a graph from edges and vertices stored in arrays */
protected AbstractGraph(int[][] edges V[] vertices) {
this.vertices = new ArrayList();
for (int i = 0; i < vertices.length; i++)
this.vertices.add(vertices[i]);
createAdjacencyLists(edges vertices.length);
}
/** Construct a graph from edges and vertices stored in List */
protected AbstractGraph(List edges List vertices) {
this.vertices = vertices;
createAdjacencyLists(edges vertices.size());
}
/** Construct a graph for integer vertices 0 1 2 and edge list */
protected AbstractGraph(List edges int numberOfVertices) {
vertices = new ArrayList(); // Create vertices
for (int i = 0; i < numberOfVertices; i++) {
vertices.add((V)(new Integer(i))); // vertices is {0 1 ...}
}
createAdjacencyLists(edges numberOfVertices);
}
/** Construct a graph from integer vertices 0 1 and edge array */
protected AbstractGraph(int[][] edges int numberOfVertices) {
vertices = new ArrayList(); // Create vertices
for (int i = 0; i < numberOfVertices; i++) {
vertices.add((V)(new Integer(i))); // vertices is {0 1 ...}
}
createAdjacencyLists(edges numberOfVertices);
}
/** Create adjacency lists for each vertex */
private void createAdjacencyLists(
int[][] edges int numberOfVertices) {
// Create a linked list
neighbors = new ArrayList>();
for (int i = 0; i < numberOfVertices; i++) {
neighbors.add(new ArrayList());
}
for (int i = 0; i < edges.length; i++) {
int u = edges[i][0];
int v = edges[i][1];
neighbors.get(u).add(v);
}
}
/** Create adjacency lists for each vertex */
private void createAdjacencyLists(
List edges int numberOfVertices) {
// Create a linked list
neighbors = new ArrayList>();
for (int i = 0; i < numberOfVertices; i++) {
neighbors.add(new ArrayList());
}
for (Edge edge: edges) {
neighbors.get(edge.u).add(edge.v);
}
}
/** Return the number of vertices in the graph */
public int getSize() {
return vertices.size();
}
/** Return the vertices in the graph */
public List getVertices() {
return vertices;
}
/** Return the object for the specified vertex */
public V getVertex(int index) {
return vertices.get(index);
}
/** Return the index for the specified vertex object */
public int getIndex(V v) {
return vertices.indexOf(v);
}
/** Return the neighbors of vertex with the specified index */
public List getNeighbors(int index) {
return neighbors.get(index);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 631 2009-10-15 14:06 Introduction to Java Programming\book\A.class
文件 429 2009-10-15 14:06 Introduction to Java Programming\book\AbstractGraph$Edge.class
文件 2849 2009-10-15 14:06 Introduction to Java Programming\book\AbstractGraph$Tree.class
文件 8825 2009-10-15 14:06 Introduction to Java Programming\book\AbstractGraph.class
文件 12435 2009-04-18 10:32 Introduction to Java Programming\book\AbstractGraph.java
文件 944 2009-10-15 14:06 Introduction to Java Programming\book\AbstractTree.class
文件 558 2007-05-13 20:44 Introduction to Java Programming\book\AbstractTree.java
文件 869 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithoutSync$Account.class
文件 705 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithoutSync$AddAPennyTask.class
文件 1636 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithoutSync.class
文件 1239 2007-05-14 06:32 Introduction to Java Programming\book\AccountWithoutSync.java
文件 1142 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithSyncUsingLock$Account.class
文件 645 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithSyncUsingLock$AddAPennyTask.class
文件 1593 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithSyncUsingLock.class
文件 1472 2007-05-14 06:32 Introduction to Java Programming\book\AccountWithSyncUsingLock.java
文件 1770 2009-10-15 14:06 Introduction to Java Programming\book\ActionInterfaceDemo$MyAction.class
文件 4144 2009-10-15 14:06 Introduction to Java Programming\book\ActionInterfaceDemo.class
文件 3821 2007-05-14 13:32 Introduction to Java Programming\book\ActionInterfaceDemo.java
文件 744 2009-10-15 14:06 Introduction to Java Programming\book\AdapterDemo$1.class
文件 839 2009-10-15 14:06 Introduction to Java Programming\book\AdapterDemo.class
文件 609 2007-05-13 09:22 Introduction to Java Programming\book\AdapterDemo.java
文件 1413 2009-10-15 14:06 Introduction to Java Programming\book\AdditionQuiz.class
文件 548 2007-10-05 22:09 Introduction to Java Programming\book\AdditionQuiz.java
文件 1252 2009-10-15 14:06 Introduction to Java Programming\book\Address.class
文件 0 2006-12-29 19:09 Introduction to Java Programming\book\address.dat
文件 823 2007-05-13 08:13 Introduction to Java Programming\book\Address.java
文件 636 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$1.class
文件 924 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$2.class
文件 1049 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$3.class
文件 1063 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$4.class
............此处省略1392个文件信息
相关资源
- java串口通信全套完整代码-导入eclip
- Android之自定义ToggleButton使用
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
- java做的房产管理系统
- 基于jsp的bbs论坛 非常详细
评论
共有 条评论