227 std::map<int, bool> MarkedForRemoval;
229 std::map<int, std::vector<int>> SeedsSharingPoint;
230 for (
size_t i = 0; i != Seeds.size(); ++i) {
231 SeedsSharingPoint[ConnectionPoint1[i]].push_back(i);
232 SeedsSharingPoint[ConnectionPoint2[i]].push_back(i);
235 for (
size_t s = 0;
s != Seeds.size(); ++
s) {
237 int StartPt = ConnectionPoint1.at(
s);
238 int EndPt = ConnectionPoint2.at(
s);
241 for (
size_t SeedsWithThisStart = 0; SeedsWithThisStart != SeedsSharingPoint[StartPt].size();
242 SeedsWithThisStart++) {
243 int i = SeedsSharingPoint[StartPt].at(SeedsWithThisStart);
244 if (ConnectionPoint1.at(i) == StartPt)
245 MidPt = ConnectionPoint2.at(i);
246 else if (ConnectionPoint2.at(i) == StartPt)
247 MidPt = ConnectionPoint1.at(i);
249 for (
size_t SeedsWithThisMid = 0; SeedsWithThisMid != SeedsSharingPoint[MidPt].size();
250 SeedsWithThisMid++) {
251 int j = SeedsSharingPoint[MidPt].at(SeedsWithThisMid);
252 if ((ConnectionPoint1.at(j) == EndPt) || (ConnectionPoint2.at(j) == EndPt)) {
254 double Lengthi = Seeds.at(i).GetLength();
255 double Lengthj = Seeds.at(j).GetLength();
256 double Lengths = Seeds.at(
s).GetLength();
258 if ((Lengths > Lengthi) && (Lengths > Lengthj)) {
259 MarkedForRemoval[i] =
true;
260 MarkedForRemoval[j] =
true;
263 if ((Lengthi > Lengths) && (Lengthi > Lengthj)) {
264 MarkedForRemoval[
s] =
true;
265 MarkedForRemoval[j] =
true;
267 if ((Lengthj > Lengthi) && (Lengthj > Lengths)) {
268 MarkedForRemoval[
s] =
true;
269 MarkedForRemoval[i] =
true;
275 for (std::map<int, bool>::reverse_iterator itrem = MarkedForRemoval.rbegin();
276 itrem != MarkedForRemoval.rend();
278 if (itrem->second ==
true) {
279 Seeds.erase(Seeds.begin() + itrem->first);
280 ConnectionPoint1.erase(ConnectionPoint1.begin() + itrem->first);
281 ConnectionPoint2.erase(ConnectionPoint2.begin() + itrem->first);
then echo File list $list not found else cat $list while read file do echo $file sed s