Пример #1
0
bool SGValidateStructureVisitor::visit(StringGraph* pGraph, Vertex* pVertex)
{
    SGAlgorithms::EdgeDescOverlapMap irreducibleMap;
    SGAlgorithms::EdgeDescOverlapMap transitiveMap;
    
    // Construct the set of overlaps reachable within the current parameters
    CompleteOverlapSet vertexOverlapSet(pVertex, pGraph->getErrorRate(), pGraph->getMinOverlap());
    vertexOverlapSet.computeIrreducible(NULL, NULL);

    SGAlgorithms::EdgeDescOverlapMap missingMap;
    SGAlgorithms::EdgeDescOverlapMap extraMap;
    
    vertexOverlapSet.getDiffMap(missingMap, extraMap);  
    
    if(!missingMap.empty())
    {
        std::cout << "Missing irreducible for " << pVertex->getID() << ":\n";
        SGAlgorithms::printOverlapMap(missingMap);
    }

    if(!extraMap.empty())
    {
        std::cout << "Extra irreducible for " << pVertex->getID() << ":\n";
        SGAlgorithms::printOverlapMap(extraMap);
    }
    return false;
}
Пример #2
0
bool SGRemodelVisitor::visit(StringGraph* pGraph, Vertex* pVertex)
{
    bool graph_changed = false;

    // Construct the set of overlaps reachable within the current parameters
    CompleteOverlapSet vertexOverlapSet(pVertex, m_remodelER, pGraph->getMinOverlap());
    SGAlgorithms::EdgeDescOverlapMap containMap;
    vertexOverlapSet.computeIrreducible(NULL, &containMap);
    SGAlgorithms::EdgeDescOverlapMap irreducibleMap = vertexOverlapSet.getOverlapMap();

    // Construct the set of edges that should be added
    EdgePtrVec edges = pVertex->getEdges();
    for(size_t i = 0; i < edges.size(); ++i)
    {
        SGAlgorithms::EdgeDescOverlapMap::iterator iter = irreducibleMap.find(edges[i]->getDesc());
        if(iter != irreducibleMap.end())
        {
            // Edge exists already
            irreducibleMap.erase(iter);
        }
        else
        {
            edges[i]->setColor(GC_BLACK);
            edges[i]->getTwin()->setColor(GC_BLACK);
            //std::cout << "Marking edge for deletion: " << edges[i]->getOverlap() << "\n";
        }
    }

    // Add remaining edges in the irreducible map
    SGAlgorithms::EdgeDescOverlapMap::iterator iter;
    for(iter = irreducibleMap.begin(); iter != irreducibleMap.end(); ++iter)
    {
        Overlap& ovr = iter->second;
        //std::cout << "Adding overlap: " << ovr << "\n";
        SGAlgorithms::createEdgesFromOverlap(pGraph, ovr, false);
        graph_changed = true;
    }

    // Update the containment flags in the graph to ensure that we can subsequently remove containment verts
    SGAlgorithms::updateContainFlags(pGraph, pVertex, containMap);

    return graph_changed;
}