Changeset 16df684 in git
- Timestamp:
- Nov 4, 2017, 4:32:48 PM (6 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 7aa8ebd3a7ec021c4a466cfa15b50b7fc4daa44d
- Parents:
- 5a5ef881f3af1708074c5c01b7add74757de7ef3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/fpadim.lib
r5a5ef88 r16df684 1215 1215 "USAGE: existsRoute(G,v,u); G a graph, v and u vertices 1216 1216 NOTE: don't pass anything to # (internal use for recursion) 1217 " 1218 { 1219 if (v == u) {return (1);} 1220 1217 @* routes always have at least one edge 1218 " 1219 { 1221 1220 int n = ncols(G); 1222 1221 … … 1224 1223 intvec visited; 1225 1224 if (size(#) > 0) { 1225 if (v == u) {return (1);} // don't check on first call so |route| >= 1 holds 1226 1226 visited = #[1]; 1227 } else { 1227 } else { // first call 1228 1228 visited[n] = 0; 1229 1229 } … … 1234 1234 // recursive DFS 1235 1235 for (int i = 1; i <= n; i++) { 1236 if (G[v,i] && !visited[i]) {1236 if (G[v,i] && (!visited[i] || i == u)) { // i == u to allow routes from u to u 1237 1237 if (existsRoute(G, i, u, visited)) { 1238 1238 return (1);
Note: See TracChangeset
for help on using the changeset viewer.