void MakeSignEpinions() { TSsParser Ss("/u/ana/data/EpinionRatings/user_rating.txt", ssfTabSep); //PSignNet Net = TSignNet::New(); TPt<TNodeEDatNet<TInt, TInt> > Net = TNodeEDatNet<TInt, TInt>::New(); TStrHash<TInt> StrSet(Mega(1), true); while (Ss.Next()) { if ( ((TStr)Ss[0]).IsPrefix("#") ) continue; const int SrcNId = StrSet.AddKey(Ss[0]); const int DstNId = StrSet.AddKey(Ss[1]); if (! Net->IsNode(SrcNId)) { Net->AddNode(SrcNId); } if (! Net->IsNode(DstNId)) { Net->AddNode(DstNId); } const int Sign = ((TStr)Ss[2]).GetInt(); Net->AddEdge(SrcNId, DstNId, Sign); } // PrintGraphStatTable(Graph, OutFNm, Desc); TStr OutFNm = "soc-sign-epinions-user-ratings"; TStr Desc = "Epinions signed social network"; // copied from gio.h - line 111 FILE *F = fopen(OutFNm.CStr(), "wt"); fprintf(F, "# Directed graph: %s\n", OutFNm.CStr()); if (! Desc.Empty()) fprintf(F, "# %s\n", (Desc).CStr()); fprintf(F, "# Nodes: %d Edges: %d\n", Net->GetNodes(), Net->GetEdges()); fprintf(F, "# FromNodeId\tToNodeId\tSign\n"); for (TNodeEDatNet<TInt,TInt>::TEdgeI ei = Net->BegEI(); ei < Net->EndEI(); ei++) { fprintf(F, "%d\t%d\t%d\n", ei.GetSrcNId(), ei.GetDstNId(), ei()()); } fclose(F); PrintGraphStatTable(Net, OutFNm, Desc); }
// Slashdot network void MakeSlashdotNet(TStr InFNm, TStr OutFNm, TStr Desc) { TSsParser Ss(InFNm, ssfTabSep); PNGraph Graph = TNGraph::New(); TStrHash<TInt> StrSet(Mega(1), true); while (Ss.Next()) { const int SrcNId = StrSet.AddKey(Ss[0]); if (! Graph->IsNode(SrcNId)) { Graph->AddNode(SrcNId); } for (int dst = 2; dst < Ss.Len(); dst++) { const int DstNId = StrSet.AddKey(Ss[dst]); if (! Graph->IsNode(DstNId)) { Graph->AddNode(DstNId); } Graph->AddEdge(SrcNId, DstNId); } } PrintGraphStatTable(Graph, OutFNm, Desc); }
void MakeLJNets(TStr InFNm, TStr OutFNm, TStr Desc){ TStrHash<TInt> StrSet(Mega(1), true); for (int i = 1; i < 13; i++){ TStr tmp = ""; if (i < 10) tmp = InFNm + "ljgraph.0" + TInt::GetStr(i); else tmp = InFNm + "ljgraph." + TInt::GetStr(i); printf("%s\n",tmp()); TSsParser Ss(tmp, ssfTabSep); PNGraph Graph = TNGraph::New(); while (Ss.Next()) { const int SrcNId = StrSet.AddKey(Ss[0]); if (! Graph->IsNode(SrcNId)) { Graph->AddNode(SrcNId); } for (int dst = 2; dst < Ss.Len(); dst++) { TStr ls,rs; ((TStr)Ss[dst]).SplitOnCh(ls,' ',rs); if (ls == ">"){ const int DstNId = StrSet.AddKey(rs); if (! Graph->IsNode(DstNId)) { Graph->AddNode(DstNId); } Graph->AddEdge(SrcNId, DstNId); } } } if (i < 10) OutFNm = "soc-lj-friends.0"+TInt::GetStr(i); else OutFNm = "soc-lj-friends."+TInt::GetStr(i); PrintGraphStatTable(Graph, OutFNm, Desc); } }
RaceAnalyzer::StrSet RaceAnalyzer::countries() const { return StrSet(); }
RaceAnalyzer::StrSet RaceAnalyzer::teams() const { return StrSet(); }
RaceAnalyzer::StrSet RaceAnalyzer::riders() const { return StrSet(); }