# processPath **Repository Path**: gterryliu/processPath ## Basic Information - **Project Name**: processPath - **Description**: 查找出一个单源多目标的有向无环图【DAG】的所有路径。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-12-03 - **Last Updated**: 2024-12-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # processPath #### 介绍 查找出一个单源多目标的有向无环图【DAG】的所有路径。 #### 软件架构 这是一个工具类,类路径是:com.giant.lsp.processPath.DAGPathsFinder,对应的文件可以直接插入到任何Java工程中。 测试框用的是springboot + maven 测试环境:jdk 17, mvn 3.8.3, springboot 3.4.0 #### 操作说明 1. git clone git@gitee.com:gterryliu/processPath.git 2. cd processPath 3. mvn clean package 4. java -jar target\processPath-0.0.1-SNAPSHOT.jar #### 代码使用示例 public static void main(String[] args) { // 示例图的邻接表表示 Map> graph = new HashMap<>(); graph.put("A", Arrays.asList("B", "C")); graph.put("B", Arrays.asList("D", "E")); graph.put("C", Arrays.asList("F")); graph.put("D", Collections.emptyList()); graph.put("E", Arrays.asList("F")); graph.put("F", Collections.emptyList()); // 源节点和目标节点集合 String source = "A"; Set targets = new HashSet<>(Arrays.asList("D", "F")); // 创建DAGPathsFinder实例并查找路径 DAGPathsFinder pathsFinder = new DAGPathsFinder(graph); List> allPaths = pathsFinder.findAllPathsFromSourceToTargets(source, targets); // 打印所有路径 for (List path : allPaths) { System.out.println(path); } } #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request