48 std::vector<float>
out;
56 std::vector<float>
out;
70 for (
const auto &
e :
s) {
80 for (
const auto &
e :
s) {
101 if (strategy == GraphMap::CollectionStrategy::Cascade) {
105 }
else if (strategy == GraphMap::CollectionStrategy::CollectAndMerge) {
114 }
else if (strategy == GraphMap::CollectionStrategy::SeedsFirst) {
121 }
else if (strategy == GraphMap::CollectionStrategy::CascadeHighest) {
139 LogDebug(
"GraphMap") <<
"Cascading...";
140 for (
const auto &
s :
seeds) {
142 std::vector<uint> collectedNodes;
150 LogTrace(
"GraphMap") <<
"\tOut edge: " <<
s <<
" --> " <<
out;
152 collectedNodes.push_back(
out);
161 if (
out !=
s && out_in ==
s)
164 LogTrace(
"GraphMap") <<
"\t\t Deleted edge: " <<
out <<
" <-- " << out_in;
175 LogTrace(
"GraphMap") <<
"Keep only highest score edge";
177 std::pair<uint, float> maxPair{0, 0};
181 if (
score > maxPair.second) {
188 LogTrace(
"GraphMap") <<
"cluster: " <<
cl <<
" edge from " << maxPair.first;
191 if (
seed != maxPair.first) {
203 LogDebug(
"GraphMap") <<
"Collecting separately each seed...";
207 std::vector<uint> collectedNodes;
208 std::vector<uint> collectedSeeds;
218 collectedSeeds.push_back(
out);
227 collectedNodes.push_back(
out);
236 simpleNodesGraphMap[
s] = collectedNodes;
237 seedsGraph.push_back({
s, collectedSeeds});
239 return std::make_pair(seedsGraph, simpleNodesGraphMap);
246 LogTrace(
"GraphMap") <<
"Starting merging";
247 for (
const auto &[
s, other_seeds] : seedsGraph) {
253 std::vector<uint> collectedNodes;
255 const auto &simpleNodes = nodesGraphMap[
s];
256 collectedNodes.insert(std::end(collectedNodes), std::begin(simpleNodes), std::end(simpleNodes));
258 for (
const auto &out_s : other_seeds) {
262 LogTrace(
"GraphMap") <<
"\tMerging nodes from seed: " << out_s;
264 const auto &otherNodes = nodesGraphMap[out_s];
267 collectedNodes.insert(std::end(collectedNodes), std::begin(otherNodes), std::end(otherNodes));
282 LogTrace(
"GraphMap") <<
"Resolving seeds";
Log< level::Info, true > LogVerbatim
void mergeSubGraphs(float threshold, GraphOutput seedsGraph, GraphOutputMap nodesGraphMap)
uint getAdjMatrix(const uint i, const uint j) const
std::map< uint, uint > nodesCount_
void addNode(const uint index, const NodeCategory category)
void resolveSuperNodesEdges(float threshold)
const std::vector< uint > & getInEdges(const uint i) const
void addNodes(const std::vector< uint > &indices, const std::vector< NodeCategory > &categories)
const std::vector< uint > & getOutEdges(const uint i) const
void collectNodes(GraphMap::CollectionStrategy strategy, float threshold)
std::vector< std::pair< uint, std::vector< uint > > > GraphOutput
void setAdjMatrix(const uint i, const uint j, const float score)
std::vector< float > getAdjMatrixCol(const uint j) const
std::vector< float > getAdjMatrixRow(const uint i) const
std::map< NodeCategory, std::vector< uint > > nodesCategories_
std::vector< std::vector< uint > > edgesOut_
void assignHighestScoreEdge()
std::map< std::pair< uint, uint >, float > adjMatrix_
void addEdge(const uint i, const uint j)
std::map< uint, std::vector< uint > > GraphOutputMap
void setAdjMatrixSym(const uint i, const uint j, const float score)
void collectCascading(float threshold)
std::pair< GraphOutput, GraphOutputMap > collectSeparately(float threshold)
std::vector< std::vector< uint > > edgesIn_