本文整理汇总了C++中TIntV::EndI方法的典型用法代码示例。如果您正苦于以下问题:C++ TIntV::EndI方法的具体用法?C++ TIntV::EndI怎么用?C++ TIntV::EndI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIntV
的用法示例。
在下文中一共展示了TIntV::EndI方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: grafoGDF
void grafoGDF(PUNGraph G) {
std::ofstream myfile;
std::vector<int> nodos = obtenerVerticesOrdenados(G);
TIntV conexiones;
myfile.open("facebook.gdf");
myfile << "nodedef>name VARCHAR" << "\n";
myfile << "edgedef>node1 VARCHAR,node2 VARCHAR" << "\n";
for (int i = 0; i < nodos.size(); i++) {
GetNodesAtHop(G, nodos[i], 1, conexiones, false);
for (int j = 0; j < conexiones.EndI() - conexiones.BegI(); j++) {
if (conexiones[j] > i) {
myfile << i << "," << conexiones[j] << "\n";
}
}
conexiones.Clr();
}
myfile.close();
}//cierre de grafoGDF
示例2: CreateNodes
void QuoteGraph::CreateNodes() {
TIntV QuoteIds;
QB->GetAllQuoteIds(QuoteIds);
TIntV::TIter QuoteIdsEnd = QuoteIds.EndI();
for (TIntV::TIter QuoteId = QuoteIds.BegI(); QuoteId < QuoteIdsEnd; QuoteId++) {
QGraph->AddNode(*QuoteId);
}
}
示例3: grafoJSON
void grafoJSON(PUNGraph G) {
std::ofstream myfile;
std::vector<int> nodos = obtenerVerticesOrdenados(G);
TIntV conexiones;
myfile.open("facebook.json");
myfile << "{ \"graph\": {" << "\n";
myfile << "\"nodes\": [" << "\n";
for (int i = 0; i < nodos.size(); i++) {
myfile << "{ \"id\": \"" << nodos[i] << "\" }";
if (i == nodos.size()-1) {
myfile << " ]," << "\n";
}
else {
myfile << "," << "\n";
}
}
myfile << "\"edges\": [\n";
for (int i = 0; i < nodos.size(); i++) {
GetNodesAtHop(G, nodos[i], 1, conexiones, false);
for (int j = 0; j < conexiones.EndI() - conexiones.BegI(); j++) {
if (conexiones[j] > i) {
myfile << "{ \"source\": \"" << i << "\", \"target\": \"" << conexiones[j] << "\" }";
if (i == nodos.size()-1) {
myfile << " ]" << "\n";
}
else {
myfile << "," << "\n";
}
}
}
conexiones.Clr();
}
myfile << "} }";
myfile.close();
}
示例4: GetGiniCoefficient
// Computes GINI coefficient of egonet as a subset of the parent graph (edges into and out of the egonet ARE considered)
double TSnap::GetGiniCoefficient(const TIntFltH DegH, const TIntV NIdV) {
typename TIntV::TIter VI;
typename TFltV::TIter DI;
TFltV DegV;
const int n = NIdV.Len();
// DegV.Gen(n); // NOTE: don't use Gen() and Sort() on the same object (!)
for (VI = NIdV.BegI(); VI < NIdV.EndI(); VI++) {
DegV.Add(DegH.GetDat(VI->Val)); // might need to change this (in / out / undirected)
}
DegV.Sort();
int i = 0;
double numerator = 0.0, denominator = 0.0;
for (DI = DegV.BegI(); DI < DegV.EndI(); DI++, i++) {
numerator += (i + 1)*DegV[i];
denominator += DegV[i];
}
return(double(2*numerator) / double(n*denominator) - double(n + 1) / double(n));
}
示例5: grafoGEXF
void grafoGEXF(PUNGraph G) {
std::ofstream myfile;
std::vector<int> nodos = obtenerVerticesOrdenados(G);
long int aristas = 0;
TIntV conexiones;
myfile.open("facebook.gexf");
myfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << "\n";
myfile << "<gexf xmlns=\"http://www.gexf.net/1.2draft\" version=\"1.2\">" << "\n";
myfile << "\t<graph mode=\"static\" defaultedgetype=\"undirected\">" << "\n";
myfile << "\t\t<edges>" << std::endl;
for (int i = 0; i < nodos.size(); i++) {
GetNodesAtHop(G, nodos[i], 1, conexiones, false);
for (int j = 0; j < conexiones.EndI() - conexiones.BegI(); j++) {
if (conexiones[j] > i) {
myfile << "\t\t\t<edge id=\"" << aristas << "\" source=\"" << i << "\" target=\"" << conexiones[j] << "\"/>" << "\n";
aristas++;
}
}
conexiones.Clr();
}
myfile << "\t\t</edges>" << "\n";
myfile << "\t</graph>" << "\n";
myfile << "</gexf>" << "\n";
myfile.close();
}//cierre de grafoGDF
示例6: grafoML
void grafoML(PUNGraph G) {
std::ofstream myfile;
std::vector<int> nodos = obtenerVerticesOrdenados(G);
long int aristas = 1;
TIntV conexiones;
myfile.open("facebook.graphml");
myfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << "\n";
myfile << "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"" << "\n";
myfile << "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" << "\n";
myfile << "\txsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">" << "\n";
myfile << " <graph id=\"G\" edgedefault=\"undirected\">" << "\n";
for (int i = 0; i < nodos.size(); i++) {
GetNodesAtHop(G, nodos[i], 1, conexiones, false);
for (int j = 0; j < conexiones.EndI() - conexiones.BegI(); j++) {
if (conexiones[j] > i) {
myfile << " \t<edge id=\"e" << aristas << "\" source=\"" << i << "\" target=\"" << conexiones[j] << "\"/>" << "\n";
aristas++;
}
}
conexiones.Clr();
}
myfile << " </graph>" << "\n";
myfile << "</graphml>" << "\n";
myfile.close();
}//cierre de grafoGDF