Reduce graph: remove orphan nodes from WM after reduction

This commit is contained in:
matlabbe
2026-07-10 12:16:09 -07:00
parent e321999b15
commit 6ff436de37
3 changed files with 18 additions and 3 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ public:
const std::map<int, Transform> & optimizedPoses,
int maxGraphDepth) const;
void convertToIntermediate(int locationId);
void deleteLocation(int locationId, std::list<int> * deletedWords = 0);
void deleteLocation(int locationId, std::list<int> * deletedWords = 0, bool keepLinked = false);
void saveLocationData(int locationId);
void removeLink(int idA, int idB);
void removeRawData(int id, bool image = true, bool scan = true, bool userData = true, bool occupancyGrid = true);
+4 -2
View File
@@ -3071,13 +3071,15 @@ void Memory::convertToIntermediate(int locationId)
}
}
void Memory::deleteLocation(int locationId, std::list<int> * deletedWords)
void Memory::deleteLocation(int locationId, std::list<int> * deletedWords, bool keepLinked = false)
{
UDEBUG("Deleting location %d", locationId);
Signature * location = _getSignature(locationId);
if(location)
{
this->moveToTrash(location, false, deletedWords);
this->moveToTrash(location, keepLinked, deletedWords);
_linksChanged = true;
_memoryChanged = true;
}
}