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

📄 dfs-dfs.html

📁 经典的数据结构源代码(java 实现)
💻 HTML
字号:
<html><head><title>Code Fragment</title></head><body text=#000000><center></center><br><br><dl><dd><pre><font color=#ff0080>/** Generic DFS traversal of a graph using the template method pattern.  * A subclass should override various methods to add functionality.  * Parameterized types:  *   V, the type for the elements stored at vertices  *   E, the type for the elements stored at edges  *   I, the type for the information object passed to the execute method  *   R, the type for the result object returned by the DFS  */</font><font color=#8000a0>public</font> <font color=#8000a0><font color=#ff8000>class</font> </font>DFS&lt;V, E, I, R&gt; {  <font color=#8000a0><font color=#8000a0>protected</font> </font>Graph&lt;V, E&gt; graph;    <font color=#ff0080>// The graph being traversed</font>  <font color=#8000a0><font color=#8000a0>protected</font> </font>Vertex&lt;V&gt; start;      <font color=#ff0080>// The start vertex for the DFS</font>  <font color=#8000a0><font color=#8000a0>protected</font> </font>I info;               <font color=#ff0080>// Information object passed to DFS</font>  <font color=#8000a0><font color=#8000a0>protected</font> </font>R visitResult;        <font color=#ff0080>// The result of a recursive traversal call</font>  <font color=#8000a0><font color=#8000a0>protected</font> </font><font color=#8000a0>static</font> <font color=#8000a0>Object </font>STATUS = <font color=#8000a0><font color=#ff8000>new</font> </font><font color=#0000ff>Object</font>();    <font color=#ff0080>// The status attribute</font>  <font color=#8000a0><font color=#8000a0>protected</font> </font><font color=#8000a0>static</font> <font color=#8000a0>Object </font>VISITED = <font color=#8000a0><font color=#ff8000>new</font> </font><font color=#0000ff>Object</font>();   <font color=#ff0080>// Visited value</font>  <font color=#8000a0><font color=#8000a0>protected</font> </font><font color=#8000a0>static</font> <font color=#8000a0>Object </font>UNVISITED = <font color=#8000a0><font color=#ff8000>new</font> </font><font color=#0000ff>Object</font>(); <font color=#ff0080>// Unvisited value</font></dl></body></html>

⌨️ 快捷键说明

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