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


C++ Vertices::end方法代码示例

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


在下文中一共展示了Vertices::end方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: isConnected

bool Graph::isConnected ()
{
    int reachedsize = 0;
    for (int v = 0; v < size; v++) { reachedVertices[v] = false; }

    std::list<int> *nextVertices = new std::list<int>();
    nextVertices->push_back(0);
    reachedVertices[0] = true;
    reachedsize++;

    while (!nextVertices->empty())
    {
		int currentVertex = nextVertices->front();
		nextVertices->pop_front();

		Vertices *adjList = adjacencySets[currentVertex];
		for (Vertices::iterator it = adjList->begin(); it != adjList->end(); ++it) {
			int adjVertex = *it;
			if (!reachedVertices[adjVertex]) {
				nextVertices->push_back(adjVertex);
				reachedVertices[adjVertex] = true;
				reachedsize++;
			}
		}
    }
	
    delete nextVertices;
	
    return reachedsize == size;
}
开发者ID:Lamarche-Perrin,项目名称:optimal_partition,代码行数:30,代码来源:graph.cpp

示例2: operatorSinternal

 void operatorSinternal(const Mesh& m, Matrix& mat, const Vertices& points, const double& coeff) 
 {
     std::cout << "INTERNAL OPERATOR S..." << std::endl;
     for ( Vertices::const_iterator vit = points.begin(); vit != points.end(); ++vit)  {
         for ( Mesh::const_iterator tit = m.begin(); tit != m.end(); ++tit) {
             mat(vit->index(), tit->index()) = _operatorSinternal(*tit, *vit) * coeff;
         }
     }
 }
开发者ID:eolivi,项目名称:openmeeg,代码行数:9,代码来源:operators.cpp

示例3: Vertices

Vertices *Graph::getAdjacentVertices (int v, int vMax)
{
    if (vMax == -1) { vMax = v; }
    Vertices *adjVertices = new Vertices();
    Vertices *adjSet = adjacencySets[v];
    for (Vertices::iterator it = adjSet->begin(); it != adjSet->end(); ++it)
    {
		int adjV = *it;
		if (adjV < vMax) { adjVertices->insert(adjV); }
    }
    return adjVertices;
}
开发者ID:Lamarche-Perrin,项目名称:optimal_partition,代码行数:12,代码来源:graph.cpp

示例4: insert

 /** Insert a function into a vertex of the forest, or create a new vertex. The (new) vertex into which the function was
  * inserted is either a child of @p parent or a root node. The @p outputs are used to select the vertex into which the
  * function is inserted (all functions of a particular vertex produced the same output when run with the same input). */
 void insert(SgAsmFunction *func, OutputValues outputs, PartitionForest::Vertex *parent) {
     Vertices candidates = parent ? parent->children : vertices_at_level(0);
     assert(!contains(candidates, func));
     for (Vertices::iterator vi=candidates.begin(); vi!=candidates.end(); ++vi) {
         Vertex *vertex = *vi;
         if (outputs.size()==vertex->outputs.size() && std::equal(outputs.begin(), outputs.end(), vertex->outputs.begin())) {
             vertex->functions.insert(func);
             return;
         }
     }
     size_t lno = parent ? parent->get_level() + 1 : 0;
     assert(lno<levels.size());
     levels[lno].vertices.insert(new Vertex(parent, func, outputs));
 }
开发者ID:LindaLovelace,项目名称:rose,代码行数:17,代码来源:CloneDetection.C

示例5: buildDataStructure

void Graph::buildDataStructure ()
{
    int lastReachedVertex = 0;
	
    while (lastReachedVertex < size)
    {
		if (!reachedVertices[lastReachedVertex])
		{
			GraphComponent *component = new GraphComponent(this);
			std::list<int> *connectedVertices = new std::list<int>();
			std::list<int> *nextVertices = new std::list<int>();
			nextVertices->push_back(lastReachedVertex);
			reachedVertices[lastReachedVertex] = true;
			
			while (!nextVertices->empty())
			{
				int vertex = nextVertices->front();
				nextVertices->pop_front();
				
				connectedVertices->push_back(vertex);
				graphComponents[vertex] = component;
				
				Vertices *adjVertices = getAdjacentVertices(vertex,size);
				for (Vertices::iterator it = adjVertices->begin(); it != adjVertices->end(); ++it)
				{
					int adjVertex = *it;
					if (!reachedVertices[adjVertex])
					{
						nextVertices->push_back(adjVertex);
						reachedVertices[adjVertex] = true;
					}
				}
				delete adjVertices;
			}
			
			delete nextVertices;
			
			component->setVertices(connectedVertices);
			graphComponentSet->insert(component);
			
			delete connectedVertices;			
		}
		
		lastReachedVertex++;
    }
	
    for (GraphComponentSet::iterator it = graphComponentSet->begin(); it != graphComponentSet->end(); ++it)
		(*it)->buildDataStructure();
}
开发者ID:Lamarche-Perrin,项目名称:optimal_partition,代码行数:49,代码来源:graph.cpp

示例6: dump

    /** Dump an entire forest to a DBMS.
     *
     *  FIXME: This should really be using something like ODBC, but ROSE is only configured to use specific DBMS like SQLite3
     *  or MySQL. Therefore, since we don't need to do any queries, we'll just generate straight SQL as text (the sqlite3x API
     *  converts all numeric values to text anyway, so there's not really any additional slowdown or loss of precision).
     *  Therefore, the @p user_name and @p password arguments are unused, and @p server_name is the name of the file to which
     *  the SQL statements are written. */
    void dump(const std::string &server_name, const std::string &user_name, const std::string &password) {
        std::ofstream dbc(server_name.c_str());
        renumber_vertices();
        dump_outputsets(dbc);
        dump_inputsets(dbc);

        Vertices leaves = get_leaves();
        size_t leafnum = 0;

        for (Vertices::const_iterator vi=leaves.begin(); vi!=leaves.end(); ++vi, ++leafnum) {
            Vertex *vertex = *vi;
            const Functions &functions = vertex->get_functions();
            dbc <<"insert into simsets (id) values (" <<leafnum <<");\n";

            for (Functions::const_iterator fi=functions.begin(); fi!=functions.end(); ++fi)
                dbc <<"insert into functions (entry_va, simset_id) values (" <<(*fi)->get_entry_va() <<", " <<leafnum <<");\n";
            for (Vertex *v=vertex; v; v=v->parent)
                dbc <<"insert into inoutpairs (simset_id, inputset_id, outputset_id) values ("
                    <<leafnum <<", " <<v->get_level() <<", " <<v->id <<");\n";
        }
    }
开发者ID:LindaLovelace,项目名称:rose,代码行数:28,代码来源:CloneDetection.C

示例7: gnuplot_print_vertices

void gnuplot_print_vertices(std::ostream& out, const Vertices& vertices)
{
    for (Vertex_iterator it = vertices.begin(); it != vertices.end(); ++it)
        out << (*it) << " " << it->unique_id() << endl;
}
开发者ID:SoumyajitG,项目名称:VolRoverN,代码行数:5,代码来源:print_utils.cpp

示例8: degree_sort

	void degree_sort(Vertices &R){
		set_degrees(R); sort(R.begin(), R.end(), desc_degree);
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:3,代码来源:MaximumClique.cpp

示例9: mcqdyn

	void mcqdyn(int* maxclique, int &sz){ 
		set_degrees(V); sort(V.begin(),V.end(), desc_degree); init_colors(V);
		for(int i = 0; i < (int)V.size() + 1; i++) S[i].i1 = S[i].i2 = 0;
		expand_dyn(V); sz = (int)QMAX.size();
		for(int i = 0; i < (int)QMAX.size(); i++) maxclique[i] = QMAX[i];
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:6,代码来源:MaximumClique.cpp

示例10: main

int main(int argc, char** argv)
{
  if(argc != 3)
    return usage(argv[0]);
  mark_tag vertex_index(1), vertex_x(2), vertex_y(3), vertex_z(4);

  sregex tface_re = bos >> *space >> "TFACE" >> *space >> eos;

  sregex vertex_re = bos >> *space >> "VRTX" 
			 >> +space >> (vertex_index=+_d)
			 >> +space >> (vertex_x=+(digit|'-'|'+'|'.'))
			 >> +space >> (vertex_y=+(digit|'-'|'+'|'.'))
			 >> +space >> (vertex_z=+(digit|'-'|'+'|'.'))
			 >> eos;

  sregex triangle_re = bos >> *space >> "TRGL"
			   >> +space >> (s1=+digit)
			   >> +space >> (s2=+digit)
			   >> +space >> (s3=+digit)
			   >> eos;
  sregex end_re = bos >> *space >> "END" >> *space >> eos;

  std::ifstream input(argv[1]);
  std::ofstream output(argv[2]);

  if(!input) {
    std::cerr << "Cannot read \"" << argv[1] << "\"!\n";
    return EXIT_FAILURE;
  }
  if(!output) {
    std::cerr << "Cannot write to \"" << argv[2] << "\"!\n";
    return EXIT_FAILURE;
  }

  std::string line;
  std::getline(input, line);
  smatch results;
  while(input && ! regex_match(line, tface_re)) // search line "TFACE"
  {
    std::getline(input, line);
  }
  std::getline(input, line);
  while(input && regex_match(line, results, vertex_re)) {
    vertices.push_back(boost::make_tuple(results[vertex_x],
					 results[vertex_y],
					 results[vertex_z]));
    std::getline(input, line);
  }
  while(input && regex_match(line, results, triangle_re)) {
    std::stringstream s;
    int i, j, k;
    s << results[1] << " " << results[2] << " " << results[3];
    s >> i >> j >> k;
    faces.push_back(boost::make_tuple(i, j, k));
    std::getline(input, line);
  }
  if(!input || !regex_match(line, end_re))
    return incorrect_input("premature end of file!");

  output << "OFF " << vertices.size() << " " << faces.size() << " " << "0\n";
  for(Vertices::const_iterator vit = vertices.begin(), vend = vertices.end();
      vit != vend; ++vit)
    output << boost::get<0>(*vit) << " "
	   << boost::get<1>(*vit) << " "
	   << boost::get<2>(*vit) << "\n";
  for(Faces::const_iterator fit = faces.begin(), fend = faces.end();
      fit != fend; ++fit)
    output << "3 " << boost::get<0>(*fit)
	   << " " << boost::get<1>(*fit)
	   << " " << boost::get<2>(*fit) << "\n";
  if(output)
    return EXIT_SUCCESS;
  else
    return EXIT_FAILURE;
};
开发者ID:ArcEarth,项目名称:cgal,代码行数:75,代码来源:GOCAD_xyz_to_OFF.cpp


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