Exemplo n.º 1
0
void TNetInfBs::LoadCascadesTxt(TSIn& SIn, const int& Model, const double& alpha) {
	TStr Line;
	SIn.GetNextLn(Line);
	while (!SIn.Eof() && Line != "") {
		TStrV NIdV; Line.SplitOnAllCh(',', NIdV);
	    AddNodeNm(NIdV[0].GetInt(), TNodeInfo(NIdV[1], 0)); SIn.GetNextLn(Line); }
	printf("All nodes read!\n");
	while (!SIn.Eof()) { SIn.GetNextLn(Line); AddCasc(Line, Model, alpha); }
	printf("All cascades read!\n");
}
void TGreedyAlg::loadCascadesFromFile(TSIn& SIn) {
    TStr line;
	SIn.GetNextLn(line);
	while (!SIn.Eof() && line != "") {
		TStrV NIdV;
        line.SplitOnAllCh(',', NIdV);
	    addNodeNm(NIdV[0].GetInt(), TNodeInfo(NIdV[1], 0)); SIn.GetNextLn(line);
    }
	printf("All nodes read!\n");
	while (!SIn.Eof()) {
        SIn.GetNextLn(line); addCascade(line);
    }
	printf("All cascades read!\n");
}
Exemplo n.º 3
0
void TNetInfBs::LoadGroundTruthTxt(TSIn& SIn) {
	GroundTruth = TNGraph::New(); TStr Line;

	// add nodes
	SIn.GetNextLn(Line);
	while (!SIn.Eof() && Line != "") {
		TStrV NIdV; Line.SplitOnAllCh(',', NIdV);
		GroundTruth->AddNode(NIdV[0].GetInt()); SIn.GetNextLn(Line); }

	// add edges
	while (!SIn.Eof()) {
		SIn.GetNextLn(Line);
		TStrV NIdV; Line.SplitOnAllCh(',', NIdV);
		GroundTruth->AddEdge(NIdV[0].GetInt(), NIdV[1].GetInt());
		Alphas.AddDat(TIntPr(NIdV[0].GetInt(), NIdV[1].GetInt())) = NIdV[2].GetFlt();
	}

	printf("groundtruth nodes:%d edges:%d\n", GroundTruth->GetNodes(), GroundTruth->GetEdges());
}