Find a path on the graph

Simply speaking , It's division from the starting point , Mark every point you pass , Back off when you find the end , Called deep search .

Judging from V Can we get to the end

Define a function , Judge if it's the end you want , If so , It's over , No. , Just walk over and mark , For other adjacent nodes , If that's the point, it's over , If not, continue .

From here on, the content mainly comes from Guo Wei of Peking University , I study as a note
bool Dfs(V) { if( V End point ) return true; if( V Old point ) return false; take V Mark as old point ;
Right and V Every adjacent node U{ if( Dfs(U) == true) return true; } return false; } int main() {
Mark all points as new ; Starting point = 1 End = 8 cout << Dfs( Starting point ); }
If you need to record the path : Add path[depth];
Node path[MAX_LEN]; //MAX_LEN Just take the total number of nodes int depth; bool Dfs(V) { if( V End point ){ path[
depth] = V; return true; } if( V Old point ) return false; take V Mark as old point ; path[depth]=V; ++
depth; 1516 Right and V Every adjacent node U { if( Dfs(U) == true) return true; } --depth; return
false; }
Representation of Graphs

Using a two-dimensional array G Storage map ,G[i][j] Representation node i Node j of
Situation on the border ( If there is no edge , Edge direction , Weight size, etc )

Technology
©2019-2020 Toolsou All rights reserved,
One is called “ Asking for the train ” A small village Finally got the train Spring Boot Lesson 16 :SpringBoot Implementation of multithreading with injection class Chrome OS, For programmers and Windows What does it mean ? Internet Marketing JAVA Convert a string to a numeric type I've been drinking soft water for three years ? What is the use of soft water and water softener You don't know ——HarmonyOS Talking about uni-app Page value transfer problem JavaScript Medium Call and ApplySparkSQL Achieve partition overlay write Character recognition technology of vehicle license plate based on Neural Network