本文整理汇总了C++中SListConstIterator类的典型用法代码示例。如果您正苦于以下问题:C++ SListConstIterator类的具体用法?C++ SListConstIterator怎么用?C++ SListConstIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SListConstIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undoGenMergers
void UMLGraph::undoGenMergers()
{
SListConstIterator<edge> it;
for(it = m_mergeEdges.begin(); it.valid(); ++it)
{
edge eMerge = *it;
node u = eMerge->source();
const DPolyline &common = bends(eMerge);
adjEntry adj, adjSucc;
for(adj = u->firstAdj(); adj != nullptr; adj = adjSucc) {
adjSucc = adj->succ();
edge e = adj->theEdge();
if(e->target() != u) continue;
DPolyline &dpl = bends(e);
dpl.pushBack(DPoint(x(u),y(u)));
ListConstIterator<DPoint> itDp;
for(itDp = common.begin(); itDp.valid(); ++itDp)
dpl.pushBack(*itDp);
m_pG->moveTarget(e,eMerge->target());
}
m_pG->delNode(u);
}
m_mergeEdges.clear();
}
示例2: createExpandedGraph
void VarEdgeInserterDynCore::blockInsert(node s, node t, List<adjEntry> &L)
{
L.clear();
// find path in SPQR-tree from an allocation node of s
// to an allocation node of t
SList<node>& path = m_pBC->dynamicSPQRForest().findPathSPQR(s, t);
// call build_subpath for every R-node building the list L of crossed edges
ExpandedGraph *pExp = createExpandedGraph(*m_pBC);
node vPred = nullptr;
path.pushBack(nullptr);
SListConstIterator<node> it;
for (it = path.begin(); *it; ++it)
{
node v = *it;
node vSucc = *it.succ();
if (m_pBC->dynamicSPQRForest().typeOfTNode(v) == DynamicSPQRForest::RComp)
buildSubpath(v, vPred, vSucc, L, *pExp, s, t);
vPred = v;
}
delete &path;
delete pExp;
}
示例3: applyLongestPaths
// computes coordinates pos of horizontal (resp. vertical) segments by
// computing longest paths in the constraint graph D
void LongestPathCompaction::computeCoords(
const CompactionConstraintGraph<int> &D,
NodeArray<int> &pos)
{
const Graph &Gd = D.getGraph();
// compute a first ranking with usual longest paths
applyLongestPaths(D,pos);
if (m_tighten == true)
{
// improve cost of ranking by moving pseudo-components
moveComponents(D,pos);
// find node with minimal position
SListConstIterator<node> it = m_pseudoSources.begin();
int min = pos[*it];
for(++it; it.valid(); ++it) {
if (pos[*it] < min)
min = pos[*it];
}
// move all nodes such that node with minimum position has position 0
for(node v : Gd.nodes)
pos[v] -= min;
}
// free resources
m_pseudoSources.clear();
m_component.init();
}
示例4:
void SpringEmbedderFRExact::ArrayGraph::initCC(int i)
{
System::alignedMemoryFree(m_orig);
System::alignedMemoryFree(m_src);
System::alignedMemoryFree(m_tgt);
System::alignedMemoryFree(m_x);
System::alignedMemoryFree(m_y);
System::alignedMemoryFree(m_nodeWeight);
m_numNodes = m_nodesInCC[i].size();
m_numEdges = 0;
m_orig = (node *) System::alignedMemoryAlloc16(m_numNodes*sizeof(node));
m_x = (double *) System::alignedMemoryAlloc16(m_numNodes*sizeof(double));
m_y = (double *) System::alignedMemoryAlloc16(m_numNodes*sizeof(double));
m_nodeWeight = (double *) System::alignedMemoryAlloc16(m_numNodes*sizeof(double));
int j = 0;
SListConstIterator<node> it;
for(it = m_nodesInCC[i].begin(); it.valid(); ++it, ++j) {
node v = *it;
m_orig[j] = v;
m_mapNode[v] = j;
m_x[j] = m_ga->x(v);
m_y[j] = m_ga->y(v);
if (m_useNodeWeight)
m_nodeWeight[j] = (m_ga->attributes() & GraphAttributes::nodeWeight) ? m_ga->weight(v) : 1.0;
else
m_nodeWeight[j] = 1.0;
adjEntry adj;
forall_adj(adj,v)
if(v->index() < adj->twinNode()->index())
++m_numEdges;
}
m_src = (int *) System::alignedMemoryAlloc16(m_numEdges*sizeof(int));
m_tgt = (int *) System::alignedMemoryAlloc16(m_numEdges*sizeof(int));
j = 0;
int srcId;
for(it = m_nodesInCC[i].begin(), srcId = 0; it.valid(); ++it, ++srcId) {
node v = *it;
adjEntry adj;
forall_adj(adj,v) {
node w = adj->twinNode();
if(v->index() < w->index()) {
m_src[j] = srcId;
m_tgt[j] = m_mapNode[w];
++j;
}
}
}
示例5: mapToH
void UpwardPlanarSubgraphSimple::call(const Graph &G, List<edge> &delEdges)
{
delEdges.clear();
// We construct an auxiliary graph H which represents the current upward
// planar subgraph.
Graph H;
NodeArray<node> mapToH(G);
for(node v : G.nodes)
mapToH[v] = H.newNode();
// We currently support only single-source acyclic digraphs ...
node s;
hasSingleSource(G,s);
OGDF_ASSERT(s != 0);
OGDF_ASSERT(isAcyclic(G));
// We start with a spanning tree of G rooted at the single source.
NodeArray<bool> visitedNode(G,false);
SListPure<edge> treeEdges;
dfsBuildSpanningTree(s,treeEdges,visitedNode);
// Mark all edges in the spanning tree so they can be skipped in the
// loop below and add (copies of) them to H.
EdgeArray<bool> visitedEdge(G,false);
SListConstIterator<edge> it;
for(it = treeEdges.begin(); it.valid(); ++it) {
edge eG = *it;
visitedEdge[eG] = true;
H.newEdge(mapToH[eG->source()],mapToH[eG->target()]);
}
// Add subsequently the remaining edges to H and test if the resulting
// graph is still upward planar. If not, remove the edge again from H
// and add it to delEdges.
for(edge eG : G.edges)
{
if(visitedEdge[eG] == true)
continue;
edge eH = H.newEdge(mapToH[eG->source()],mapToH[eG->target()]);
if (UpwardPlanarity::isUpwardPlanar_singleSource(H) == false) {
H.delEdge(eH);
delEdges.pushBack(eG);
}
}
}
示例6: sinkSwitch
void FaceSinkGraph::doInit()
{
const ConstCombinatorialEmbedding &E = *m_pE;
NodeArray<node> sinkSwitch(E,nullptr); // corresponding node in F (if any)
NodeArray<bool> isSinkSwitch(E,true);
NodeArray<int> visited(E,-1);
int faceNo = -1;
for(face f : E.faces)
{
faceNo++;
node faceNode = newNode();
m_originalFace[faceNode] = f;
SListPure<node> nodesInF;
adjEntry adj1 = f->firstAdj(), adj = adj1;
do {
node v = adj->theNode();
// if the graph is not biconnected, then node v can visited more than once
if (visited[v] != faceNo) {
nodesInF.pushBack(v);
visited[v] = faceNo;
}
if (v == m_source)
m_containsSource[faceNode] = true;
isSinkSwitch[adj->theEdge()->source()] = false;
adj = adj->twin()->cyclicPred();
} while (adj != adj1);
SListConstIterator<node> it;
for(it = nodesInF.begin(); it.valid(); ++it)
{
node v = *it;
if(isSinkSwitch[v]) {
if (sinkSwitch[v] == nullptr) {
node vF = newNode();
m_originalNode[vF] = v;
sinkSwitch[v] = vF;
}
newEdge(faceNode,sinkSwitch[v]);
}
}
for(it = nodesInF.begin(); it.valid(); ++it)
isSinkSwitch[*it] = true;
}
}
示例7: transform
// Transforms KuratowskiWrapper in KuratowskiSubdivision
void BoyerMyrvold::transform(
const KuratowskiWrapper& source,
KuratowskiSubdivision& target,
NodeArray<int>& count,
EdgeArray<int>& countEdge)
{
// init linear counting structure
node kn[6];
int p = 0;
SListConstIterator<edge> itE;
for (itE = source.edgeList.begin(); itE.valid(); ++itE) {
const edge& e(*itE);
OGDF_ASSERT(!countEdge[e]);
countEdge[e] = 1;
if (++count[e->source()] == 3) kn[p++] = e->source();
if (++count[e->target()] == 3) kn[p++] = e->target();
}
// transform edgelist of KuratowskiSubdivision to KuratowskiWrapper
OGDF_ASSERT(p==5 || p==6);
node n;
edge e,f,h;
List<edge> L;
if (p==5) { // K5
kn[5] = 0;
target.init(10);
for (int k = 0; k<5; k++) {
forall_adj_edges(e,kn[k]) {
if (!countEdge[e]) continue;
n = kn[k];
f = e;
// traverse degree-2-path
while (count[n = f->opposite(n)] == 2) {
L.pushBack(f);
forall_adj_edges(h,n) {
if (countEdge[h] && h != f) {
f = h;
break;
}
}
}
L.pushBack(f);
int i = 0;
while (kn[i] != n) i++;
if (i > k) {
if (k==0) i--;
else if (k==1) i+=2;
else i += k+2;
target[i].conc(L);
} else L.clear();
}
}
} else { // k33
示例8: while
//
// o u t p u t O p e r a t o r for DinoUmlDiagramGraph
//
ostream &operator<<(ostream &os, const DinoUmlDiagramGraph &diagramGraph)
{
// Header with diagram name and type
os << "\n--- " << diagramGraph.getDiagramTypeString()
<< " \"" << diagramGraph.m_diagramName << "\" ---\n" << endl;
// Nodes
// Initialize iterators
SListConstIterator<NodeElement*> nodeIt = diagramGraph.m_containedNodes.begin();
SListConstIterator<double> xIt = diagramGraph.m_x.begin();
SListConstIterator<double> yIt = diagramGraph.m_y.begin();
SListConstIterator<double> wIt = diagramGraph.m_w.begin();
SListConstIterator<double> hIt = diagramGraph.m_h.begin();
// Traverse lists
while (nodeIt.valid()){
os << "Node " << diagramGraph.m_modelGraph.getNodeLabel(*nodeIt)
<< " with geometry ("
<< *xIt << ", "
<< *yIt << ", "
<< *wIt << ", "
<< *hIt << ")." << endl;
++nodeIt;
++xIt;
++yIt;
++wIt;
++hIt;
} // while
// Edges
// Traverse lists
SListConstIterator<EdgeElement*> edgeIt = diagramGraph.m_containedEdges.begin();
for (edgeIt = diagramGraph.m_containedEdges.begin();
edgeIt.valid();
++edgeIt)
{
os << "Edge between "
<< diagramGraph.m_modelGraph.getNodeLabel((*edgeIt)->source())
<< " and "
<< diagramGraph.m_modelGraph.getNodeLabel((*edgeIt)->target())
<< endl;
}
return os;
} // <<
示例9:
void VarEdgeInserterDynUMLCore::BCandSPQRtreesUML::insertEdgePath(
edge eOrig, const SList<adjEntry>& crossedEdges)
{
SList<edge> ti;
SList<node> tj;
for (adjEntry adj : crossedEdges) {
ti.pushBack(adj->theEdge());
tj.pushBack(adj->theEdge()->target());
}
m_pr.insertEdgePath(eOrig, crossedEdges);
Graph::EdgeType typeOfEOrig = m_pr.typeOrig(eOrig);
int costOfEOrig = m_costOrig ? eOrig ? (*m_costOrig)[eOrig] : 0 : 1;
node v = m_pr.copy(eOrig->source());
SListConstIterator<edge> it = ti.begin();
SListConstIterator<node> jt = tj.begin();
SListConstIterator<adjEntry> kt;
for (kt = crossedEdges.begin(); it.valid(); ++it, ++jt, ++kt) {
edge e = *it;
node u = e->target();
adjEntry a;
for (a = u->firstAdj(); a->theEdge()->target() != *jt; a = a->succ())
;
edge f = a->theEdge();
m_dynamicSPQRForest.updateInsertedNode(e, f);
e = m_dynamicSPQRForest.rep(e);
f = m_dynamicSPQRForest.rep(f);
m_typeOf[f] = m_typeOf[e];
m_cost[f] = m_cost[e];
for (a = u->firstAdj(); a->theEdge()->source() != v; a = a->succ());
f = a->theEdge();
m_dynamicSPQRForest.updateInsertedEdge(f);
f = m_dynamicSPQRForest.rep(f);
m_typeOf[f] = typeOfEOrig;
m_cost[f] = costOfEOrig;
v = u;
}
node u = m_pr.copy(eOrig->target());
adjEntry a;
for (a = v->firstAdj(); a->theEdge()->target() != u; a = a->succ())
;
edge f = a->theEdge();
m_dynamicSPQRForest.updateInsertedEdge(f);
f = m_dynamicSPQRForest.rep(f);
m_typeOf[f] = typeOfEOrig;
m_cost[f] = costOfEOrig;
}
示例10: isParallelFree
bool isParallelFree(const Graph &G)
{
if (G.numberOfEdges() <= 1) return true;
SListPure<edge> edges;
parallelFreeSort(G,edges);
SListConstIterator<edge> it = edges.begin();
edge ePrev = *it, e;
for(it = ++it; it.valid(); ++it, ePrev = e) {
e = *it;
if (ePrev->source() == e->source() && ePrev->target() == e->target())
return false;
}
return true;
}
示例11: sinkSwitch
void FaceSinkGraph::doInit()
{
const ConstCombinatorialEmbedding &E = *m_pE;
NodeArray<node> sinkSwitch(E,0); // corresponding node in F (if any)
NodeArray<bool> isSinkSwitch(E,true);
face f;
forall_faces(f,E)
{
node faceNode = newNode();
m_originalFace[faceNode] = f;
SListPure<node> nodesInF;
adjEntry adj1 = f->firstAdj(), adj = adj1;
do {
node v = adj->theNode();
nodesInF.pushBack(v);
if (v == m_source)
m_containsSource[faceNode] = true;
isSinkSwitch[adj->theEdge()->source()] = false;
adj = adj->twin()->cyclicPred();
} while (adj != adj1);
SListConstIterator<node> it;
for(it = nodesInF.begin(); it.valid(); ++it)
{
node v = *it;
if(isSinkSwitch[v]) {
if (sinkSwitch[v] == 0) {
node vF = newNode();
m_originalNode[vF] = v;
sinkSwitch[v] = vF;
}
newEdge(faceNode,sinkSwitch[v]);
}
}
for(it = nodesInF.begin(); it.valid(); ++it)
isSinkSwitch[*it] = true;
}
示例12: isParallelFreeUndirected
bool isParallelFreeUndirected(const Graph &G)
{
if (G.numberOfEdges() <= 1) return true;
SListPure<edge> edges;
EdgeArray<int> minIndex(G), maxIndex(G);
parallelFreeSortUndirected(G,edges,minIndex,maxIndex);
SListConstIterator<edge> it = edges.begin();
edge ePrev = *it, e;
for(it = ++it; it.valid(); ++it, ePrev = e) {
e = *it;
if (minIndex[ePrev] == minIndex[e] && maxIndex[ePrev] == maxIndex[e])
return false;
}
return true;
}
示例13: numParallelEdges
int numParallelEdges(const Graph &G)
{
if (G.numberOfEdges() <= 1) return 0;
SListPure<edge> edges;
parallelFreeSort(G,edges);
int num = 0;
SListConstIterator<edge> it = edges.begin();
edge ePrev = *it, e;
for(it = ++it; it.valid(); ++it, ePrev = e) {
e = *it;
if (ePrev->source() == e->source() && ePrev->target() == e->target())
++num;
}
return num;
}
示例14: OGDF_ASSERT
// builds expansion graph of i-th biconnected component of the original graph
void ExpansionGraph::init(int i)
{
OGDF_ASSERT(0 <= i);
OGDF_ASSERT(i <= m_component.high());
// remove previous component
for(node v : nodes) {
node vOrig = m_vOrig[v];
if (vOrig)
m_vCopy[vOrig] = nullptr;
}
clear();
// create new component
SListConstIterator<edge> it;
for(it = m_component[i].begin(); it.valid(); ++it)
{
edge e = *it;
edge eCopy = newEdge(getCopy(e->source()),getCopy(e->target()));
m_eOrig[eCopy] = e;
}
// expand vertices
for(node v : nodes)
{
if (original(v) && v->indeg() >= 1 && v->outdeg() >= 1) {
node vPrime = newNode();
m_vRep[vPrime] = m_vOrig[v];
SListPure<edge> edges;
v->outEdges(edges);
SListConstIterator<edge> it;
for(it = edges.begin(); it.valid(); ++it)
moveSource(*it,vPrime);
newEdge(v,vPrime);
}
}
}
示例15: isAcyclic
// test if graphAcyclicTest plus edges in tmpAugmented is acyclic
// removes added edges again
bool UpwardPlanarSubgraphSimple::checkAcyclic(
GraphCopySimple &graphAcyclicTest,
SList<Tuple2<node,node> > &tmpAugmented)
{
SListPure<edge> added;
SListConstIterator<Tuple2<node,node> > it;
for(it = tmpAugmented.begin(); it.valid(); ++it)
added.pushBack(graphAcyclicTest.newEdge(
graphAcyclicTest.copy((*it).x1()),
graphAcyclicTest.copy((*it).x2())));
bool acyclic = isAcyclic(graphAcyclicTest);
SListConstIterator<edge> itE;
for(itE = added.begin(); itE.valid(); ++itE)
graphAcyclicTest.delEdge(*itE);
return acyclic;
}