当前位置: 首页>>代码示例>>C++>>正文


C++ TIntV::BegI方法代码示例

本文整理汇总了C++中TIntV::BegI方法的典型用法代码示例。如果您正苦于以下问题:C++ TIntV::BegI方法的具体用法?C++ TIntV::BegI怎么用?C++ TIntV::BegI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TIntV的用法示例。


在下文中一共展示了TIntV::BegI方法的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
开发者ID:yocoHM,项目名称:grafosGephi,代码行数:28,代码来源:main.cpp

示例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);
  }
}
开发者ID:snap-stanford,项目名称:curis-2012,代码行数:8,代码来源:quotegraph.cpp

示例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();
  
  
}
开发者ID:yocoHM,项目名称:grafosGephi,代码行数:50,代码来源:main.cpp

示例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));
}
开发者ID:huisaddison,项目名称:snap,代码行数:19,代码来源:wstats.cpp

示例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
开发者ID:yocoHM,项目名称:grafosGephi,代码行数:36,代码来源:main.cpp

示例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
开发者ID:yocoHM,项目名称:grafosGephi,代码行数:36,代码来源:main.cpp


注:本文中的TIntV::BegI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。