#include <leetcode.h>
|
static vector< vector< int > > | allPathsSourceTarget (vector< vector< int > > &graph) |
|
static int | dfs (vector< vector< int > > &graph, vector< vector< int > > &ans, int cur) |
|
◆ allPathsSourceTarget()
vector< vector< int > > leetcode::all_paths_from_source_to_target::Solution::allPathsSourceTarget |
( |
vector< vector< int > > & | graph | ) |
|
|
static |
在文件 leetcode.cpp 第 6407 行定义.
6407 {
6408 vector<vector<int>>
ans;
6410 for(auto &path: ans) {
6411 path.push_back(0);
6412 path = vector(path.rbegin(), path.rend());
6413 }
6415 }
vector< vector< int > > ans
static int dfs(vector< vector< int > > &graph, vector< vector< int > > &ans, int cur)
引用了 dfs().
◆ dfs()
int leetcode::all_paths_from_source_to_target::Solution::dfs |
( |
vector< vector< int > > & | graph, |
|
|
vector< vector< int > > & | ans, |
|
|
int | cur ) |
|
static |
在文件 leetcode.cpp 第 6417 行定义.
6417 {
6418 int ret = 0;
6419 if(cur == graph.size() - 1) {
6420 ans.emplace_back(vector(1, cur));
6421 return 1;
6422 }
6423 for(const auto next: graph[cur]) {
6424 const int n =
dfs(graph, ans, next);
6425 ret += n;
6426 for(
int i =
ans.size() - 1, j = 0; j < n; i--, j++) {
6427 ans[i].emplace_back(cur);
6428 }
6429 }
6430 return ret;
6431 }
引用了 dfs().
被这些函数引用 allPathsSourceTarget() , 以及 dfs().
该类的文档由以下文件生成: