CMS 3D CMS Logo

Functions
GraphUtil.h File Reference
#include "DataFormats/Math/interface/Graph.h"
#include "DataFormats/Math/interface/GraphWalker.h"
#include <iostream>
#include <string>

Go to the source code of this file.

Functions

template<class N , class E >
void graph_combine (const math::Graph< N, E > &g1, const math::Graph< N, E > &g2, const N &n1, const N &n2, const N &root, math::Graph< N, E > &result)
 
template<class N , class E >
void graph_tree_output (const math::Graph< N, E > &g, const N &root, std::ostream &os)
 
template<class N , class E >
void output (const math::Graph< N, E > &g, const N &root)
 

Function Documentation

◆ graph_combine()

template<class N , class E >
void graph_combine ( const math::Graph< N, E > &  g1,
const math::Graph< N, E > &  g2,
const N n1,
const N n2,
const N root,
math::Graph< N, E > &  result 
)

Definition at line 21 of file GraphUtil.h.

26  {
27  result = g1;
28  result.replace(n1, n2);
29  math::GraphWalker<N, E> walker(g2, n2);
30  while (walker.next()) {
31  const N& parent = g2.nodeData((++walker.stack().rbegin())->first->first);
32  result.addEdge(parent, walker.current().first, walker.current().second);
33  }
34  result.replace(n2, root);
35 }

References math::GraphWalker< N, E >::current(), dqmdumpme::first, diffTwoXMLs::g1, diffTwoXMLs::g2, N, math::GraphWalker< N, E >::next(), class-composition::parent, mps_fire::result, and math::GraphWalker< N, E >::stack().

◆ graph_tree_output()

template<class N , class E >
void graph_tree_output ( const math::Graph< N, E > &  g,
const N root,
std::ostream &  os 
)

Definition at line 38 of file GraphUtil.h.

38  {
40  bool go = true;
41  unsigned int depth = 0;
42  while (go) {
43  std::string s(2 * depth, ' ');
44  os << ' ' << s << w.current().first << '(' << w.current().second << ')' << std::endl;
45  go = w.firstChild();
46  if (go) {
47  ++depth;
48  } else if (w.stack().size() > 1 && w.nextSibling()) {
49  go = true;
50  } else {
51  go = false;
52  while (w.parent()) {
53  --depth;
54  if (w.stack().size() > 1 && w.nextSibling()) {
55  go = true;
56  break;
57  }
58  }
59  }
60  }
61 }

References LEDCalibrationChannels::depth, g, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and w.

◆ output()

template<class N , class E >
void output ( const math::Graph< N, E > &  g,
const N root 
)

Definition at line 10 of file GraphUtil.h.

10  {
12  bool go = true;
13  while (go) {
14  std::cout << w.current().first << ' ';
15  go = w.next();
16  }
17  std::cout << std::endl;
18 }

References gather_cfg::cout, g, and w.

math::GraphWalker
Definition: GraphWalker.h:12
gather_cfg.cout
cout
Definition: gather_cfg.py:144
diffTwoXMLs.g1
g1
Definition: diffTwoXMLs.py:52
dqmdumpme.first
first
Definition: dqmdumpme.py:55
alignCSCRings.s
s
Definition: alignCSCRings.py:92
w
const double w
Definition: UKUtility.cc:23
N
#define N
Definition: blowfish.cc:9
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
root
Definition: RooFitFunction.h:10
diffTwoXMLs.g2
g2
Definition: diffTwoXMLs.py:71
mps_fire.result
result
Definition: mps_fire.py:311
class-composition.parent
parent
Definition: class-composition.py:88
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4