本文整理汇总了C++中graph::Node类的典型用法代码示例。如果您正苦于以下问题:C++ Node类的具体用法?C++ Node怎么用?C++ Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Node类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
TEST_F(VertexWeightedGraphTest, testGetNode)
{
Graph::Node *n;
n = wmg->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
}
开发者ID:MattBBaker,项目名称:INDDGO-survey,代码行数:7,代码来源:VertexWeightedGraphTest.cpp
示例2: buildGraph
void ORD::buildGraph() {
Graph::GraphCreatorFile creator(this->filename);
Graph::GraphUtil util;
Graph::GraphProperties properties;
int wr;
int size;
MPI_Comm_size(comm, &size);
MPI_Comm_rank(comm, &wr);
G = creator.create_weighted_mutable_graph();
properties.make_canonical(G);
char compname[512];
if (!properties.is_connected(G))
{
Graph::GraphReaderWriterFactory factory;
Graph::VertexWeightedGraph *H;
// Since we are going to proceed with processing largest
// component , set a mark as not original and write largest
// component into a file.
this->set_original(false);
vector<list<int> *> members;
int comp;
comp = util.find_all_components(G, &members);
DEBUG("found %d components\n", comp);
int i = 0;
int gsize = 0;
int index = 0;
for (int j = 0; j < comp; j++)
{
i = members[j]->size();
if (i > gsize)
{
gsize = i;
index = j;
sprintf(compname, "%s_%d_comp", filename.c_str(), gsize);
DEBUG("new larger comp : %d\n", gsize);
}
}
this->set_filename(compname);
H = creator.create_component(G, members[index], true);
delete G;
G = H;
// Change the label into 1-base DIMACS format
int j = 0;
int gs = G->get_num_nodes();
Graph::Node *n;
for (int i = 0 ; i < gs; i++)
{
n = G->get_node(i);
n->set_label(i+1);
}
}
}
开发者ID:MattBBaker,项目名称:INDDGO-survey,代码行数:60,代码来源:ORD.cpp
示例3:
TEST_F(MutableGraphTest, testGetNode)
{
Graph::Node *n;
n = mg->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
}
开发者ID:xydinesh,项目名称:INDDGO,代码行数:7,代码来源:MutableGraphTest.cpp
示例4: remove_all_edges
void remove_all_edges(int i){
list<int>::iterator it;
Graph::Node *n = mg->get_node(i);
list<int> nbrs = n->get_nbrs();
for(it = nbrs.begin(); it != nbrs.end(); ++it){
mg->remove_edge(i, *it);
}
}
开发者ID:jdlschrock,项目名称:INDDGO-survey,代码行数:8,代码来源:GraphPropertyTest.cpp
示例5:
TEST_F(MutableGraphTest, testIsEdge)
{
Graph::Node *n;
n = mg->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
EXPECT_TRUE(mg->is_edge(108, 100));
}
开发者ID:MattBBaker,项目名称:INDDGO-survey,代码行数:9,代码来源:MutableGraphTest.cpp
示例6: while
bool
BasicBlock::dominatedBy(BasicBlock *that)
{
Graph::Node *bn = &that->dom;
Graph::Node *dn = &this->dom;
while (dn && dn != bn)
dn = dn->parent();
return dn != NULL;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:11,代码来源:nv50_ir_bb.cpp
示例7:
TEST_F(GraphPropertyTest, testClique)
{
Graph::Node *n;
n = mg->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
EXPECT_FALSE(properties.is_clique(mg, &nbrs));
nbrs.push_back(108);
properties.make_clique(mg, &nbrs);
EXPECT_TRUE(properties.is_clique(mg, &nbrs));
}
开发者ID:jdlschrock,项目名称:INDDGO-survey,代码行数:12,代码来源:GraphPropertyTest.cpp
示例8:
TEST_F(MetisGraphReaderTest, testGetNode)
{
//dim_writer->write_graph(g);
creator.set_file_name("data/1dc.128.met");
creator.set_graph_type("Metis");
g = creator.create_graph();
Graph::Node *n;
n = g->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
}
开发者ID:MattBBaker,项目名称:INDDGO-survey,代码行数:13,代码来源:MetisGraphReaderTest.cpp
示例9:
TEST_F(DIMACSGraphWriterTest, testGetNode)
{
dim_writer->write_graph(g);
creator.set_file_name("../data/1dc.128.out");
creator.set_graph_type("DIMACS");
g = creator.create_graph();
Graph::Node *n;
n = g->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
}
开发者ID:xydinesh,项目名称:INDDGO,代码行数:13,代码来源:DIMACSGraphWriterTest.cpp
示例10:
TEST_F(GraphReaderWriterFactoryTest, testDimacsGraphWriterGetNode)
{
gw = factory.create_writer("dimacs", "data/dimacsout.out");
gw->write_graph(g);
creator.set_file_name("data/dimacsout.out");
creator.set_graph_type("dimacs");
g = creator.create_graph();
Graph::Node *n;
n = g->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
}
开发者ID:zbhuang,项目名称:INDDGO,代码行数:13,代码来源:GraphReaderWriterFactoryTest.cpp
示例11:
TEST_F(GraphTest, testIsEdge)
{
Graph::Node *n;
n = g->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
EXPECT_TRUE(g->is_edge(108, 100));
n = g->get_node(80);
list<int> nbrs2 = n->get_nbrs();
EXPECT_EQ(22, nbrs2.size());
EXPECT_FALSE(g->is_edge(80, 12));
}
开发者ID:abitofalchemy,项目名称:INDDGO,代码行数:14,代码来源:GraphTest.cpp
示例12:
TEST_F(MetisGraphWriterTest, testIsEdge)
{
dim_writer->write_graph(g);
creator.set_file_name("../data/1dc.128.met");
creator.set_graph_type("Metis");
g = creator.create_graph();
Graph::Node *n;
n = g->get_node(108);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(24, nbrs.size());
EXPECT_TRUE(g->is_edge(108, 100));
}
开发者ID:xydinesh,项目名称:INDDGO,代码行数:16,代码来源:MetisGraphWriterTest.cpp
示例13: separateConnectedComponents
void LazyConstraintCallback::separateConnectedComponents( Graph const & g
, GraphVariables const & vars
, Graph::Node const & root
, NodeSetVector const & nonZeroNodesComponents
, int & nCuts
) {
IloExpr rhs( getEnv() );
for ( const NodeSet& S : nonZeroNodesComponents ) {
// only consider the non-zero components that don't contain the root
auto it = S.find( root );
if ( it == S.end() || it->componentIndex() != root.componentIndex() ) {
// determine dS
NodeSet dS;
for ( Graph::Node i : S ) {
for ( Graph::Edge e : g.incEdges( i ) ) {
Graph::Node j = g.oppositeNode( i, e );
if ( S.find( j ) == S.end() )
{
dS.insert( j );
}
}
}
constructRHS( vars, dS, S, rhs );
for ( Graph::Node i : S ) {
assert( isValid( g, i, dS, S ) );
add( vars.xVars[vars.nodeToIndex[i]] <= rhs, IloCplex::UseCutPurge ).end();
++nCuts;
}
}
}
rhs.end();
}
开发者ID:falcong,项目名称:xheinz,代码行数:35,代码来源:LazyConstraintCallback.cpp
示例14: outputMetisFormat
void ORD::outputMetisFormat() {
int n = G->get_num_nodes();
cout << n << " " << G->get_num_edges() << endl;
for (int i = 0; i < n; i++)
{
Graph::Node *no = G->get_node(i);
list<int> *l = no->get_nbrs_ptr();
list<int>::iterator it = l->begin();
for (; it != l->end(); ++it)
{
cout << (*it)+1 << " ";
}
cout << endl;
}
}
开发者ID:MattBBaker,项目名称:INDDGO-survey,代码行数:16,代码来源:ORD.cpp
示例15: diffImageStatus
/**
* @brief Process the difference between 2 readers and return status.
*/
EImageStatus diffImageStatus(Graph::Node& read1, Graph::Node& read2, Graph::Node& stat, Graph& graph, const bfs::path& filename1, const bfs::path& filename2)
{
if (bfs::exists(filename1) == 0 || bfs::exists(filename2) == 0)
return eImageStatusNoFile;
if (bfs::file_size(filename1) == 0 || bfs::file_size(filename2) == 0)
return eImageStatusFileSizeError;
try
{
// Setup parameters
read1.getParam("filename").setValue(filename1.string());
read2.getParam("filename").setValue(filename2.string());
if( !verbose )
std::cout.rdbuf(0);
graph.compute(stat);
std::cout.rdbuf(_stdCout);
if( verbose )
{
std::cout << "diff = ";
for (unsigned int i = 0; i < 3; ++i)
{
std::cout << stat.getParam("quality").getDoubleValueAtIndex(i) << " ";
}
std::cout << std::endl;
}
for (unsigned int i = 0; i < 3; ++i)
{
if (stat.getParam("quality").getDoubleValueAtIndex(i) != 0.0 )
return eImageStatusDiffNotNull;
}
//std::cout << stat << std::endl;
return eImageStatusDiffNull;
}
catch (...)
{
std::cerr << boost::current_exception() << std::endl;
std::cerr << boost::current_exception_diagnostic_information() << std::endl;
return eImageStatusImageError;
}
}
开发者ID:davebarkeruk,项目名称:TuttleOFX,代码行数:47,代码来源:main.cpp
示例16: out_file
TEST_F(DIMACSGraphWriterTest, testshuffle)
{
string out_file("../data/1dc.128.out.shuf");
dim_writer->set_out_file_name(out_file);
dim_writer->shuffle(g, time(NULL));
dim_writer->write_graph(g);
creator.set_file_name("../data/1dc.128.out.shuf");
creator.set_graph_type("DIMACS");
g = creator.create_graph();
Graph::Node *n;
n = g->get_node(108);
list<int> nbrs = n->get_nbrs();
//BDS - problem if randomization happens to put a vertex of
//degree 24 in this location. Temporary fix.
//EXPECT_NE(24, nbrs.size());
EXPECT_NE(0, nbrs.size());
}
开发者ID:xydinesh,项目名称:INDDGO,代码行数:19,代码来源:DIMACSGraphWriterTest.cpp
示例17: classifyDFS
void Graph::classifyDFS(Node *curr, int& seq)
{
Graph::Edge *edge;
Graph::Node *node;
curr->visit(++seq);
curr->tag = 1;
for (edge = curr->out; edge; edge = edge->next[0]) {
node = edge->target;
if (edge->type == Edge::DUMMY)
continue;
if (node->getSequence() == 0) {
edge->type = Edge::TREE;
classifyDFS(node, seq);
} else
if (node->getSequence() > curr->getSequence()) {
edge->type = Edge::FORWARD;
} else {
edge->type = node->tag ? Edge::BACK : Edge::CROSS;
}
}
for (edge = curr->in; edge; edge = edge->next[1]) {
node = edge->origin;
if (edge->type == Edge::DUMMY)
continue;
if (node->getSequence() == 0) {
edge->type = Edge::TREE;
classifyDFS(node, seq);
} else
if (node->getSequence() > curr->getSequence()) {
edge->type = Edge::FORWARD;
} else {
edge->type = node->tag ? Edge::BACK : Edge::CROSS;
}
}
curr->tag = 0;
}
开发者ID:Ponozhovshchina,项目名称:mesa,代码行数:42,代码来源:nv50_ir_graph.cpp
示例18:
TEST_F(GraphUtilTest, testRecomputeDegree)
{
Graph::Node *n = mg->get_node(36);
list<int> nbrs = n->get_nbrs();
EXPECT_EQ(29, nbrs.size());
EXPECT_FALSE(mg->is_edge(36, 3));
mg->add_edge(36, 3);
EXPECT_EQ(30, mg->get_degree(36));
mg->remove_edge(36, 3);
nbrs.push_back(3);
n->set_nbr(nbrs);
nbrs = n->get_nbrs();
EXPECT_EQ(30, nbrs.size());
EXPECT_EQ(29, mg->get_degree(36));
util.recompute_degrees(mg);
EXPECT_EQ(30, mg->get_degree(36));
}
开发者ID:nik0p0l,项目名称:INDDGO,代码行数:21,代码来源:GraphUtilTest.cpp
示例19: find_elim_ordering
int ORD::find_elim_ordering() {
int ws;
int wr;
char eoname[512];
char eoname_other[512];
// Get size and rank from the communicator
MPI_Comm_size(comm, &ws);
MPI_Comm_rank(comm, &wr);
double xtime = MPI_Wtime();
sprintf(eoname, "%s.order.%d", this->filename.c_str(), ws);
sprintf(eoname_other, "%s.order_other.%d", this->filename.c_str(), ws);
DEBUG("size: %d, rank %d \n", ws, wr);
int n = G->get_num_nodes();
int x = n/ws;
int xm = n%ws;
int i = 0;
DEBUG("n: %d x: %d xm: %d \n", n, x, xm);
vector<int> xadj;
vector<int> adjncy;
vector<int> vtxdist(ws + 1, 0);
vector<int> sizes(2*ws,0);
vector<int> ordering(x+1, 0);
vector<int> recvcnt(ws, 0);
vector<int> displ(ws, 0);
int numflag = 0;
int options[10];
options[0] = 0;
vtxdist[0] = 0;
for (i = 1; i <= ws; i++)
{
vtxdist[i] = vtxdist[i - 1] + x;
if (i <= xm)
vtxdist[i]++;
}
// prepareing displacement and receive counts to use with MPI_Gatherv
for (i = 0; i < ws; i++)
{
recvcnt[i] = x;
if (i < xm)
recvcnt[i] ++;
if (i > 0)
displ[i] += displ[i - 1] + recvcnt[i - 1];
}
DEBUG("range: %d, %d\n", vtxdist[wr], vtxdist[wr + 1]);
int j = 0;
xadj.push_back(0);
for (i = vtxdist[wr]; i < vtxdist[wr + 1]; i++)
{
Graph::Node *no = G->get_node(i);
list<int> *l = no->get_nbrs_ptr();
list<int>::iterator it = l->begin();
for (; it != l->end(); ++it)
{
adjncy.push_back(*it);
j++;
}
xadj.push_back(j);
}
if (METIS_OK != ParMETIS_V3_NodeND(&vtxdist.front(), &xadj.front(), &adjncy.front(), &numflag, options, &ordering.front(), &sizes.front(), &comm))
{
FERROR("error occured while processing parmetis, aborting\n");
MPI_Abort(MPI_COMM_WORLD, -1);
}
DEBUG("output from ParMETIS\n");
double parmet_time = MPI_Wtime() - xtime;
vector<int> recvbuf;
n = G->get_num_nodes();
if (wr == 0)
{
recvbuf = vector<int>(n, 0);
}
if (MPI_SUCCESS !=
MPI_Gatherv((void *)&ordering.front(), recvcnt[wr], MPI_INT,
(void *)&recvbuf.front(), &recvcnt.front(), &displ.front(), MPI_INT,
0, comm))
{
FERROR("MPI error occured at Gatherv, Abort!\n");
MPI_Abort(comm, -1);
}
//.........这里部分代码省略.........
开发者ID:MattBBaker,项目名称:INDDGO-survey,代码行数:101,代码来源:ORD.cpp
注:本文中的graph::Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论