Belle II Software  release-08-01-10
Belle2::DNN Namespace Reference

namespace for DirectedNodeNetwork-related stuff More...

Functions

template<class NodeEntryType >
void printCANetwork (DirectedNodeNetwork< NodeEntryType, CACell > &network, const std::string &fName)
 TODO. More...
 
template<class NodeEntryType , class AnyMetaInfo >
void printNetwork (DirectedNodeNetwork< NodeEntryType, AnyMetaInfo > &network, const std::string &fName)
 overloaded print-version for typical activeSector-networks without CACell-stuff
 

Detailed Description

namespace for DirectedNodeNetwork-related stuff

Function Documentation

◆ printCANetwork()

void Belle2::DNN::printCANetwork ( DirectedNodeNetwork< NodeEntryType, CACell > &  network,
const std::string &  fName 
)

TODO.

  • code isSeed and getState to colors for fill and for border function for printing networks with CACells:

takes network and prints it to given fileName.

prerequisite for NodeEntryType:

  • std::string getName()

Definition at line 38 of file NodeNetworkHelperFunctions.h.

39  {
40  std::string fullOut = "digraph G {\n";
41  fullOut +=
42  "ranksep=\"0.2\" edge[labelfontsize=\"8\" fontsize=\"8\" arrowsize=\"0.9\"] nodesep=\"0.2\" node[shape=\"box\" width=\"0\" height=\"0\" fontsize=\"10\"]\n";
43  // write vertices:
44  for (auto* node : network) {
45  fullOut += "\"" + node->getEntry().getName() + "\"" +
46  " [label=\"" +
47  node->getEntry().getName() +
48  " State,Seed: " +
49  std::to_string(node->getMetaInfo().getState()) +
50  "," +
51  std::to_string(node->getMetaInfo().isSeed()) +
52  "\"];\n";
53  }
54  // write edges:
55  for (auto* node : network) {
56  for (auto* innerNode : node->getInnerNodes()) {
57  auto innerEntry = innerNode->getEntry();
58  std::string arrowStyle = (node->getMetaInfo().getState() == (innerNode->getMetaInfo().getState() + 1)) ? "" : " [style=dotted]";
59  fullOut += "\"" + node->getEntry().getName() + "\" -> \"" + innerEntry.getName() + "\"" + arrowStyle + ";\n";
60  }
61  }
62  fullOut += "labelloc=\"t\";\nlabel=\"" + fName + "\";\n";
63  fullOut += "}\n";
64 
65  std::ofstream ofs;
66  ofs.open(fName + ".gv", std::ofstream::out | std::ofstream::trunc);
67  ofs << fullOut;
68  ofs.close();
69  };