https://hal.archives-ouvertes.fr/lirmm-02136558
Tip revision: 11651125345aefdd4503aab2db8bbedc1d7edcaa authored by Software Heritage on 22 May 2019, 09:01:30 UTC
hal: Deposit 275 in collection hal
hal: Deposit 275 in collection hal
Tip revision: 1165112
main.cpp
#include "include/File.h"
#include "include/Extension.h"
#include "include/Frequency.h"
#include "include/Sumgra.h"
#include "include/GraphIso.h"
#include "include/SubgraphMiner.h"
int main(int argc, char* argv[])
{
/// Script input
VecOfStr in_args(argc-1);
for (int i = 0; i < argc-1; ++i)
in_args[i] = argv[i+1];
std::string filePath = in_args[0];
std::string outPath = in_args[1];
int support = std::stoi(in_args[2]);
///
/// Manual input.
// std::string filePath = "/home/vijay/Phd/MULTIGRAPHS/trunk/dataset/mining/smallLabeled/"; // Graph location |
// int support = 145; // support value |
///
/// Read data graph
std::string nodeFile = filePath + "data/nodes.txt";
std::string edgeFile = filePath + "data/edges.txt";
GraphParameter dataGraphInfo;
File dataGraph;
dataGraph.ReadContents(nodeFile, edgeFile, dataGraphInfo);
/// Build data graph indexes
Sumgra subIsomorphism;
IndexType graphIndexes;
subIsomorphism.BuildIndexes(dataGraphInfo, graphIndexes);
clock_t Time = clock();
/// Mine the multigraph
std::map<int, std::deque<FSG>> allFSG;
int noOfFsg;
SubgraphMiner subgraphMiner;
subgraphMiner.MineFrequentSubgraphs(dataGraphInfo, graphIndexes, support, allFSG, noOfFsg);
double totalTime = double(clock()-Time)/CLOCKS_PER_SEC;
cout << "Total time: " << totalTime << endl;
cout << "No. of levels: " << allFSG.size() << endl;
for(auto it = allFSG.begin(); it != allFSG.end(); ++it)
cout << it->first << ": " << it->second.size() << endl;
/// Script output
ofstream outFile;
std::string timeFile = outPath + "mugram_time.txt";
outFile.open(timeFile, std::ios_base::app); // append the data to the existing file |
outFile << support << "\t" << 1000*totalTime << endl;
ofstream outFileP;
std::string patternFile = outPath + "mugram_patterns.txt";
outFileP.open(patternFile, std::ios_base::app); // append the data to the existing file |
outFileP << noOfFsg << endl;
}