1 Star 0 Fork 0

besti1923/JAVA

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test7.java 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
yifei 提交于 5年前 . shiyan9
package text.java;
import java.util.Stack;
public class test7 {
public static void main(String[] args) {
Graph graph = new Graph();
System.out.println("该图的邻接表为:");
outputGraph(graph);
}
/**
* 输出图的邻接表的方法。
* @param graph 要输出的图
*/
public static void outputGraph(Graph graph){
for (int i=0;i<graph.verNum;i++){
Vertex vertex = graph.verArray[i];
System.out.print(vertex.verName);
Edge current = vertex.edgeLink;
while (current != null){
System.out.print("-->"+current.tailName);
current = current.broEdge;
}
System.out.println();
}
}
// public static void rudu(Graph graph){
// int[] a = new int[graph.verNum];
// for(int k=0;k<graph.verNum;k++)
// a[k]=0;
// }
//
// }
public static void outputtuota(Graph graph,int[] a){
Stack<Integer> stack = new Stack<>();
for (int i=0;i<graph.verNum;i++){
if(a[i]==0){
System.out.println(i+1);
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/besti1923/java.git
git@gitee.com:besti1923/java.git
besti1923
java
JAVA
master

搜索帮助