本文整理汇总了C++中Loader::loadDataset方法的典型用法代码示例。如果您正苦于以下问题:C++ Loader::loadDataset方法的具体用法?C++ Loader::loadDataset怎么用?C++ Loader::loadDataset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::loadDataset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
Utility util;
START_TIME=time (NULL);
string str;
// PARSE PARAMETERS
MIN_DENSITY=atof(argv[4]);
MIN_DIM=atoi(argv[6]);
MIN_SIZE=atoi(argv[8]);
DISTANCE_FUNCTION=atoi(argv[10]);
cout<<"Minimum density : "<<MIN_DENSITY<<endl;
cout<<"Minimum dim : "<<MIN_DIM<<endl;
cout<<"Minimum pattern size : "<<MIN_SIZE<<endl;
// REDIRECT IO
std::ostringstream converter;
converter<<argv[2]<<"experimental_results/alpha_"<<MIN_DENSITY<<"_minGraph_"<<MIN_DIM<<"_minSize_"<<MIN_SIZE<<"_distFunc_"<<DISTANCE_FUNCTION<<".txt";
cout<<"Redirecting output to:"<<converter.str()<<endl;
freopen (converter.str().c_str(),"w",stdout);
// LOAD
Loader loader;
loader.loadDataset(argv[2]);
// PREPROCESS INPUT
util.removeNonHomegenousEdges();
//util.partitionGraph(NUMBER_OF_PARTITIONS);
util.extractComponents(); // only in windows
vector<ConnectedComponent*>::const_iterator iter=connectedComponents.begin();
int numberOfComponents = (int)connectedComponents.size();
for (int i=0; i<numberOfComponents;i++)
{
ConnectedComponent* ccPtr = connectedComponents[i];
cout<<"\tComponent "<<i<< " size:"<< ccPtr->getSize()<<endl;
}
cout<<"\n++++++++++++++++++++++++++++++++\n\n\n"<<endl;
//cout<<"Number of processors:"<<omp_get_num_procs()<<endl;
cout<<"Number of processors used:"<<NUMBER_OF_CPUs<<endl;
//omp_set_num_threads(NUMBER_OF_CPUs);
cout<<"\n\nStarting algorithm!"<<endl;
//1- FIRST PHASE
//#pragma omp parallel for
for (int i=0; i<numberOfComponents;i++)
{
ConnectedComponent* ccPtr = connectedComponents[i];
cout<<"\n\n\n\n======================\n\n\tStarting Connected Component: "<<ccPtr->getID()<<"\tSize: "<<ccPtr->getSize()<<endl;
cout<<"Find seed patterns!"<<endl;
ccPtr->findSeedPatterns();
cout<<"Expand-by-one!"<<endl;
ccPtr->expand_by_one(true);
cout<<"\t\tFinished: "<<ccPtr->getID()<<"\tSize: "<<ccPtr->getSize()<<" # of Found Patterns:"<<ccPtr->getTempMaximalPatterns()->size()<<endl;
}
cout<<"\n--------------------------------\n\n\n"<<endl;
cout<<"\n\n\n\nRun time before merge (in minutes): "<<((float)time(NULL)-START_TIME)/60<<" "<<endl;
cout<<"Run time before merge (in second): "<<(time(NULL)-START_TIME)<<" "<<endl;
// all patterns will be merged to this guy
ConnectedComponent* masterComponent = new ConnectedComponent(-1);
// statistics
cout<<"\n\n"<<endl;
int patternCounter=0;
for (int i=0; i<numberOfComponents;i++)
{
ConnectedComponent* ccPtr = connectedComponents[i];
//cout<<"\tBefore Component "<<i<< " maximal pattern size:"<< ccPtr->getMaximalPatterns()->size()<<endl;
//ccPtr->removeRedundancyInMaximalPatterns();
patternCounter+=(int)ccPtr->getTempMaximalPatterns()->size();
//cout<<"\tAfter Component "<<i<< " maximal pattern size:"<< ccPtr->getMaximalPatterns()->size()<<endl;
}
cout<<"Before redundancy elim, total patterns in components:"<<patternCounter<<endl;
cout<<"\n\n\n\nRun time before redundancy (in minutes): "<<((float)time(NULL)-START_TIME)/60<<" "<<endl;
cout<<"Run time before redundancy (in second): "<<(time(NULL)-START_TIME)<<" "<<endl;
//3- REDUNDANCY ELIMINATION
util.unifyPatternsOfAllComponents2(masterComponent);
cout<<"After removing redundancy number of patterns:"<<masterComponent->getMaximalPatterns()->size()<<endl;
// statistics
cout<<"\n\n\n\n Final number of patterns:"<<masterComponent->getMaximalPatterns()->size()<<endl;
masterComponent->printMaximalPatterns();
//CLEAN MEMORY
util.deallocateConnectedComponents();
util.deallocateNodes();
//cout<<"Pattern counter:"<<Pattern::counter<<endl;
cout<<"Total run time(minutes): "<<((float)time(NULL)-START_TIME)/60<<" "<<endl;
cout<<"Total run time(seconds): "<<(time(NULL)-START_TIME)<<" "<<endl;
return 0;
}