1038 | | Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g)); |
1039 | | if (Base::_pred) |
1040 | | alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred)); |
1041 | | if (Base::_dist) |
1042 | | alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist)); |
1043 | | if (Base::_reached) |
1044 | | alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached)); |
1045 | | if (Base::_processed) |
1046 | | alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed)); |
1047 | | alg.run(s,t); |
1048 | | if (Base::_path) |
1049 | | *reinterpret_cast<Path*>(Base::_path) = alg.path(t); |
1050 | | if (Base::_di) |
1051 | | *Base::_di = alg.dist(t); |
1052 | | return alg.reached(t); |
| 1038 | if ((Base::_pred || Base::_path) && (Base::_dist || Base::_di)) { |
| 1039 | // Default PredMap and DistMap |
| 1040 | Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g)); |
| 1041 | if (Base::_pred) |
| 1042 | alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred)); |
| 1043 | if (Base::_dist) |
| 1044 | alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist)); |
| 1045 | if (Base::_reached) |
| 1046 | alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached)); |
| 1047 | if (Base::_processed) |
| 1048 | alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed)); |
| 1049 | alg.run(s,t); |
| 1050 | if (Base::_path) |
| 1051 | *reinterpret_cast<Path*>(Base::_path) = alg.path(t); |
| 1052 | if (Base::_di) |
| 1053 | *Base::_di = alg.dist(t); |
| 1054 | return alg.reached(t); |
| 1055 | } |
| 1056 | else if (Base::_pred || Base::_path) { |
| 1057 | // Use NullMap as DistMap |
| 1058 | typedef NullMap<typename Digraph::Node, int> NullDistMap; |
| 1059 | Bfs<Digraph,TR>::SetDistMap<NullDistMap>::Create |
| 1060 | alg(*reinterpret_cast<const Digraph*>(Base::_g)); |
| 1061 | NullDistMap map; |
| 1062 | alg.distMap(map); |
| 1063 | if (Base::_pred) |
| 1064 | alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred)); |
| 1065 | if (Base::_reached) |
| 1066 | alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached)); |
| 1067 | if (Base::_processed) |
| 1068 | alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed)); |
| 1069 | alg.run(s,t); |
| 1070 | if (Base::_path) |
| 1071 | *reinterpret_cast<Path*>(Base::_path) = alg.path(t); |
| 1072 | return alg.reached(t); |
| 1073 | } |
| 1074 | else if (Base::_dist || Base::_di) { |
| 1075 | // Use NullMap as PredMap |
| 1076 | typedef NullMap<typename Digraph::Node, typename Digraph::Arc> |
| 1077 | NullPredMap; |
| 1078 | Bfs<Digraph,TR>::SetPredMap<NullPredMap>::Create |
| 1079 | alg(*reinterpret_cast<const Digraph*>(Base::_g)); |
| 1080 | NullPredMap map; |
| 1081 | alg.predMap(map); |
| 1082 | if (Base::_dist) |
| 1083 | alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist)); |
| 1084 | if (Base::_reached) |
| 1085 | alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached)); |
| 1086 | if (Base::_processed) |
| 1087 | alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed)); |
| 1088 | alg.run(s,t); |
| 1089 | if (Base::_di) |
| 1090 | *Base::_di = alg.dist(t); |
| 1091 | return alg.reached(t); |
| 1092 | } |
| 1093 | else { |
| 1094 | // Use NullMap as PredMap and DistMap |
| 1095 | typedef NullMap<typename Digraph::Node, int> NullDistMap; |
| 1096 | typedef NullMap<typename Digraph::Node, typename Digraph::Arc> |
| 1097 | NullPredMap; |
| 1098 | Bfs<Digraph,TR>::SetDistMap<NullDistMap>::SetPredMap<NullPredMap> |
| 1099 | ::Create alg(*reinterpret_cast<const Digraph*>(Base::_g)); |
| 1100 | NullDistMap dmap; |
| 1101 | NullPredMap pmap; |
| 1102 | alg.distMap(dmap).predMap(pmap); |
| 1103 | if (Base::_reached) |
| 1104 | alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached)); |
| 1105 | if (Base::_processed) |
| 1106 | alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed)); |
| 1107 | alg.run(s,t); |
| 1108 | return alg.reached(t); |
| 1109 | } |