本文整理汇总了C++中Graph::BeginEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ Graph::BeginEdges方法的具体用法?C++ Graph::BeginEdges怎么用?C++ Graph::BeginEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::BeginEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindMaximalMatching
void AlgorithmMAXIMALMATCHING::FindMaximalMatching(Graph& G, EdgeSet& Matching, VertexSet& MatchedVertices)
{
for(EdgeIterator e = G.BeginEdges(); e != G.EndEdges(); e++)
{
VertexSet Incident = (*e)->CollectIncidentVertices(1,1,1);
if(SetHelper::IntersectionEmpty(MatchedVertices,Incident))
{
Matching.insert(*e);
SetHelper::DestructiveUnion(MatchedVertices, Incident);
}
}
}
示例2: Export
void ExportFilterRGML::Export(Graph& G, ostream& os, VertexColoring& vertexcoloring,
EdgeColoring& edgecoloring, float dpi, float edgewidth, float vertexradius)
{
StringTranslatorXML Translator;
os << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
os << "<!-- www.Open-Graphtheory.org -->\n\n";
os << "<rdf:RDF\n"
<< " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"
<< " xmlns=\"http://purl.org/puninj/2001/05/rgml-schema#\"\n"
<< " xmlns:rgml=\"http://purl.org/puninj/2001/05/rgml-schema#\"\n"
<< ">\n\n";
os << " <Graph rdf:ID=\"graph\" rgml:directed=\"false\">\n";
/// declare vertices
os << " <nodes>\n";
os << " <rdf:Bag>\n";
for(VertexIterator v = G.BeginVertices(); v != G.EndVertices(); v++)
os << " <rdf:li rdf:resource=\"#n" << (*v)->GetID() << "\"/>\n";
os << " </rdf:Bag>\n";
os << " </nodes>\n\n";
/// declare edges and arcs
os << " <edges>\n";
os << " <rdf:Bag>\n";
for(EdgeIterator e = G.BeginEdges(); e != G.EndEdges(); e++)
os << " <rdf:li rdf:resource=\"#e" << (*e)->GetID() << "\"/>\n";
os << " </rdf:Bag>\n";
os << " </edges>\n";
os << " </Graph>\n\n";
/// write vertices
for(VertexIterator v = G.BeginVertices(); v != G.EndVertices(); v++)
os << " <Node rdf:ID=\"n" << (*v)->GetID() << "\" rgml:label=\"" << Translator.Translate((*v)->GetLabel()) << "\"/>\n";
/// write edges
for(EdgeIterator ei = G.BeginEdges(); ei != G.EndEdges(); ei++)
{
Edge* e = *ei;
if(e->IsHyperedge())
continue;
os << "\n <Edge rdf:ID=\"e" << e->GetID() << "\" directed=\"" << (e->IsEdge()?"false":"true") << "\""
<< " rgml:label=\"" << Translator.Translate(e->GetLabel()) << "\">\n";
os << " <source rdf:resource=\"#n" << e->From()->GetID() << "\"/>\n";
os << " <target rdf:resource=\"#n" << e->To()->GetID() << "\"/>\n";
os << " </Edge>\n";
}
/// write hyperedges
for(EdgeIterator ei = G.BeginEdges(); ei != G.EndEdges(); ei++)
{
Edge *e = *ei;
if(!e->IsHyperedge())
continue;
os << "\n <Edge rdf:ID=\"e" << e->GetID() << "\""
<< " rgml:label=\"" << Translator.Translate(e->GetLabel()) << "\">\n";
os << " <nodes>\n";
os << " <rdf:Seq>\n";
for(VertexEdgeConnectionIterator conn = e->BeginConnections(); conn != e->EndConnections(); conn++)
os << " <rdf:li rdf:resource=\"#n" << (*conn)->GetVertex()->GetID() << "\"/>\n";
os << " </rdf:Seq>\n";
os << " </nodes>\n";
os << " </Edge>\n";
}
os << "\n</rdf:RDF>\n";
}