@@ -658,7 +658,7 @@ class AlgYTO {
658658 * TODO: see if the algorithms can be unified to remove duplicate code
659659 **/
660660
661- void mmcycle_robust (graph &gr, CDouble *lambda, std::shared_ptr<std:: vector<const arc*> > *cycle) {
661+ void mmcycle_robust (graph &gr, CDouble *lambda, std::vector<const arc*> *cycle) {
662662 const CDouble MCR_EPSILON_RATIO = 1 .0e-8L ;
663663
664664 // set up initial tree
@@ -914,12 +914,12 @@ class AlgYTO {
914914 }
915915
916916 if (cycle != nullptr ) {
917- *cycle = std::make_shared<std:: vector<const arc*> >();
917+ *cycle = std::vector<const arc*>();
918918 if (min_a_ptr != NILA) {
919- (* cycle)-> push_back (min_a_ptr);
919+ cycle -> push_back (min_a_ptr);
920920 a_ptr = min_a_ptr->tail ->parent_in ;
921921 while (a_ptr->head != min_a_ptr->head ) {
922- (* cycle)-> push_back (a_ptr);
922+ cycle -> push_back (a_ptr);
923923 a_ptr = a_ptr->tail ->parent_in ;
924924 }
925925 }
@@ -1078,7 +1078,7 @@ CDouble getDelay(const MCMedge& e) { return e.d; }
10781078 */
10791079CDouble
10801080maxCycleMeanAndCriticalCycleYoungTarjanOrlin (MCMgraph &mcmGraph,
1081- std::shared_ptr<std:: vector<const MCMedge *> > *cycle) {
1081+ std::vector<const MCMedge *> *cycle) {
10821082 graph ytoGraph;
10831083
10841084 // Convert the graph to an input graph for the YTO algorithm
@@ -1088,17 +1088,17 @@ maxCycleMeanAndCriticalCycleYoungTarjanOrlin(MCMgraph &mcmGraph,
10881088
10891089 CDouble min_cr = 0 ;
10901090 if (cycle != nullptr ) {
1091- std::shared_ptr<std:: vector<const arc*>> ytoCycle = nullptr ;
1091+ std::vector<const arc*> ytoCycle;
10921092
10931093 // Find maximum cycle mean
10941094 std::int32_t ytoCycLen = 0 ;
10951095 alg.mmcycle_robust (ytoGraph, &min_cr, &ytoCycle);
10961096
1097- size_t len = ytoCycle-> size ();
1097+ size_t len = ytoCycle. size ();
10981098
1099- *cycle = std::make_shared<std:: vector<const MCMedge*> >(len);
1099+ *cycle = std::vector<const MCMedge*>(len);
11001100 for (uint i = 0 ; i < len; i++) {
1101- (*cycle)-> at (i) = ytoCycle-> at (i)->mcmEdge ;
1101+ (*cycle). at (i) = ytoCycle. at (i)->mcmEdge ;
11021102 }
11031103
11041104 } else {
@@ -1131,14 +1131,11 @@ CDouble maxCycleMeanYoungTarjanOrlin(MCMgraph &mcmGraph) {
11311131 */
11321132
11331133CDouble maxCycleRatioAndCriticalCycleYoungTarjanOrlin (MCMgraph &mcmGraph,
1134- std::shared_ptr<std:: vector<const MCMedge*> > *cycle) {
1134+ std::vector<const MCMedge*> *cycle) {
11351135 graph ytoGraph;
11361136
11371137 // catch special case when the graph has no edges
11381138 if (mcmGraph.nrVisibleEdges () == 0 ) {
1139- if (cycle != nullptr ) {
1140- *cycle = nullptr ;
1141- }
11421139 return 0.0 ;
11431140 }
11441141
@@ -1150,19 +1147,19 @@ CDouble maxCycleRatioAndCriticalCycleYoungTarjanOrlin(MCMgraph &mcmGraph,
11501147 CDouble min_cr = 0 ;
11511148 if (cycle != nullptr ) {
11521149
1153- std::shared_ptr<std:: vector<const arc*>> ytoCycle = nullptr ;
1150+ std::vector<const arc*> ytoCycle;
11541151
11551152 // Find maximum cycle ratio
11561153 std::int32_t ytoCycLen = 0 ;
11571154 alg.mmcycle_robust (ytoGraph, &min_cr, &ytoCycle);
11581155
1159- *cycle = std::make_shared<std:: vector<const MCMedge *>> (ytoCycle-> size ());
1156+ *cycle = std::vector<const MCMedge *>(ytoCycle. size ());
11601157
11611158 // note that mmcycle returns the critical cycle following edges backwards
11621159 // therefore reverse the order of the edges.
1163- size_t len = ytoCycle-> size ();
1160+ size_t len = ytoCycle. size ();
11641161 for (uint i = 0 ; i < len; i++) {
1165- (* cycle) ->at (i) = (* ytoCycle) [len - 1 - i]->mcmEdge ;
1162+ cycle->at (i) = ytoCycle[len - 1 - i]->mcmEdge ;
11661163 }
11671164
11681165 } else {
@@ -1193,7 +1190,7 @@ CDouble maxCycleRatioYoungTarjanOrlin(MCMgraph &mcmGraph) {
11931190 */
11941191
11951192CDouble minCycleRatioAndCriticalCycleYoungTarjanOrlin (MCMgraph &mcmGraph,
1196- std::shared_ptr<std:: vector<const MCMedge*> > *cycle) {
1193+ std::vector<const MCMedge*> *cycle) {
11971194 graph ytoGraph;
11981195
11991196 // Convert the graph to an input graph for the YTO algorithm
@@ -1204,18 +1201,18 @@ CDouble minCycleRatioAndCriticalCycleYoungTarjanOrlin(MCMgraph &mcmGraph,
12041201 CDouble min_cr = 0 ;
12051202 if (cycle != nullptr ) {
12061203
1207- std::shared_ptr<std:: vector<const arc*>> ytoCycle = nullptr ;
1204+ std::vector<const arc*> ytoCycle;
12081205
12091206 // Find minimum cycle ratio
12101207 std::int32_t ytoCycLen = 0 ;
12111208 alg.mmcycle_robust (ytoGraph, &min_cr, &ytoCycle);
12121209
1213- size_t len = (* ytoCycle) .size ();
1214- *cycle = std::make_shared<std:: vector<const MCMedge*> >(len);
1210+ size_t len = ytoCycle.size ();
1211+ *cycle = std::vector<const MCMedge*>(len);
12151212
12161213
12171214 for (uint i = 0 ; i < len; i++) {
1218- (* cycle) ->at (i) = (* ytoCycle) [i]->mcmEdge ;
1215+ cycle->at (i) = ytoCycle[i]->mcmEdge ;
12191216 }
12201217
12211218 } else {
0 commit comments