コード例 #1
0
int gSpan::support_counts(Projected& projected)
{
    std::map<UINT,UINT> counts;
    for(Projected::iterator cur = projected.begin(); cur!=projected.end(); ++cur)
        counts[cur->id]+=1;

    int total=0;
    for(std::map<UINT,UINT> :: iterator it = counts.begin(); it!=counts.end(); it++)
    {
        total += (*it).second;
    }
    return total;
}
コード例 #2
0
std::set<int> gSpan::total_occurance(Projected& projected) {
    std::set<int> total;

    for(Projected::iterator cur = projected.begin(); cur!= projected.end(); ++cur)
    {

        total.insert(cur->id);
        //std::cout <<" From: " << edge->from << " To: " << edge->to << " ELabel: " << edge->elabel << endl;
        //     edge = edge->
        // }

    }
    return total;
}
コード例 #3
0
UINT gSpan::support (Projected& projected)
{
    UINT oid = 0xffffffff;
    UINT size = 0;

    //Graph g(directed);
    //DFS_CODE.toGraph(g);
    //g.write();
    for(Projected::iterator cur=projected.begin(); cur!=projected.end(); ++cur)
    {

        //std::cout << "Support Cur id: "<< cur->id << "Edge: From: " << cur->edge->from << " To: " << cur->edge->to << " Elabel: " << cur->edge->elabel << std::endl;
        if(oid!=cur->id)
            ++size;
        oid = cur->id;
    }

    return size;
}
コード例 #4
0
void gSpan::report(Projected& projected,UINT sup)
{
    if(maxpat_max > maxpat_min && DFS_CODE.nodeCount() > maxpat_max)
        return;
    //*os << maxpat_min << ":" << DFS_CODE.nodeCount() << ":" << maxpat_min << std::endl;
    if(maxpat_min > 0 && DFS_CODE.nodeCount() < maxpat_min)
        return;
    if(where) {
#ifdef DEBUG
        /*
        *os<<"<pattern>\n";
        *os<<"<id>"<<ID<<"</id>\n";
        *os<<"<support>"<<sup<<"</support>\n";
        *os<<"<what>";
        fos<<"<pattern>\n";
        fos<<"<id>"<<ID<<"</id>\n";
        fos<<"<support>"<<sup<<"</support>\n";
        fos<<"<what>";
        */
//        *os << "where = " << where << " enc = " << enc << endl;
#endif
        *os << "t # " << ID << " " << sup << endl;

    }

    if(!enc) {
        Graph g(directed);
#ifdef DEBUG
//        std::cout << "in report g.size = " << g.size() << endl;
//        std::cout << "in report g.edge_size = " << g.edge_size() << endl;
//        std::cout << "in report g.vertex_size = " << g.vertex_size() << endl;
#endif
        DFS_CODE.toGraph(g);

        if(!where)
            *os << "t # " << ID << " * " << sup;//fos << "t # " << ID << " * " << sup;
        //*os << "\n";
        //fos << "\n";

        g.write(*os);

        //g.write(fos);
    } else {
        if(!where)
            *os << "<" << ID << "> " << sup << " [";
        DFS_CODE.write (*os);

        if(!where) *os << "]";
    }

    if(where) {
        /*
        *os << "</what>\n<where>";
        fos << "</what>\n<where>";
        */
        *os << "x ";
        UINT oid = 0xffffffff;
        for(Projected::iterator cur = projected.begin(); cur != projected.end(); ++cur) {
            if(oid != cur->id) {
                if(cur!=projected.begin()) *os<< " ";
                fos<< " ";
                *os<<cur->id;
                fos<<cur->id;
            }
            oid = cur->id;
        }
        /*
        *os << "</where>\n</pattern>";
        fos << "</where>\n</pattern>";
        */
    }
    *os<<"\n";
    //fos<<"\n";
    ++ID;
}