Content-Length: 2323 | pFad | http://github.com/algorithm-visualizer/algorithm-visualizer/pull/769.diff
thub.com diff --git a/bfs.txt b/bfs.txt new file mode 100644 index 00000000..ab98ca8e --- /dev/null +++ b/bfs.txt @@ -0,0 +1,72 @@ +// import visualization libraries { +import org.algorithm_visualizer.*; +import java.util.LinkedList; +import java.util.Queue; +// } + +class Main { + // 可视化组件 + private GraphTracer graphTracer = new GraphTracer("BFS"); + private LogTracer logTracer = new LogTracer("控制台"); + private Array1DTracer visitedTracer = new Array1DTracer("访问状态"); + + // 图结构定义 + private int[][] adjMatrix = { + {0,1,1,0,0}, + {1,0,0,0,1}, + {1,0,0,1,0}, + {0,0,1,0,1}, + {0,1,0,1,0} + }; + private boolean[] visited = new boolean[5]; + + void bfs(int start) { + QueueFetched URL: http://github.com/algorithm-visualizer/algorithm-visualizer/pull/769.diff
Alternative Proxies: