Go to the documentation of this file.
37 #ifndef TTA_BOOST_GRAPH_HH
38 #define TTA_BOOST_GRAPH_HH
40 #include <boost/version.hpp>
42 #if BOOST_VERSION < 103500
44 #include <boost/graph/detail/edge.hpp>
48 template <
class D,
class V>
51 const detail::edge_desc_impl<D,V>& b) {
52 return a.get_property() < b.get_property();
69 #include <boost/config.hpp>
70 #include <boost/graph/adjacency_list.hpp>
71 #include <boost/graph/subgraph.hpp>
82 template <
typename GraphNode,
typename GraphEdge>
86 typedef std::set<GraphNode*, typename GraphNode::Comparator >
NodeSet;
87 typedef std::set<GraphEdge*, typename GraphEdge::Comparator >
EdgeSet;
102 Node&
node(
const int index,
bool cacheResult)
const;
103 virtual Edge&
edge(
const int index)
const;
141 const Node* tail = NULL,
bool childs =
false);
145 const Node* head = NULL,
bool childs =
false);
148 const Node* tail = NULL);
151 const Node* head = NULL);
162 const Node& nHead)
const;
169 const Node&
node,
bool ignoreBackEdges=
false,
170 bool ignoreForwardEdges=
false)
const;
172 const Node&
node,
bool ignoreBackEdges=
false,
173 bool ignoreForwardEdges=
false)
const;
203 const Node& nTail,
const Node& nHead)
const;
214 int tmp =
reinterpret_cast<size_t>(
node);
215 return tmp ^ (tmp >> 16);
218 int tmp =
reinterpret_cast<size_t>(
edge);
219 return tmp ^ (tmp >> 16);
245 typedef typename boost::adjacency_list<
246 boost::listS, boost::vecS,
257 typedef typename GraphTraits::edge_iterator
EdgeIter;
259 typedef typename GraphTraits::vertex_iterator
NodeIter;
286 const Node& nHead)
const;
304 const GraphNode* startNode = NULL,
int startingLength = 0,
305 bool looping =
false)
const;
317 mutable std::map<const GraphNode*,int, typename GraphNode::Comparator>
319 mutable std::map<const GraphNode*,int, typename GraphNode::Comparator>
323 mutable std::map<const GraphNode*,int, typename GraphNode::Comparator>
325 mutable std::map<const GraphNode*,int, typename GraphNode::Comparator>
335 typedef hash_map<const Edge*, EdgeDescriptor, GraphHashFunctions>
337 typedef hash_map<const Node*, NodeDescriptor, GraphHashFunctions>
std::map< const GraphNode *, int, typename GraphNode::Comparator > loopingSinkDistances_
virtual NodeSet predecessors(const Node &node, bool ignoreBackEdges=false, bool ignoreForwardEdges=false) const
void calculateSinkDistance(const GraphNode &node, int len, bool looping=false) const
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
virtual Edge & outEdge(const Node &node, const int index) const
size_t operator()(const GraphEdge *edge) const
virtual void removeEdge(Edge &e)
std::map< const GraphNode *, int, typename GraphNode::Comparator > sourceDistances_
virtual Node & tailNode(const Edge &edge) const
virtual bool hasEdge(const Node &nTail, const Node &nHead) const
virtual Node & headNode(const Edge &edge) const
Node & node(const int index) const
void clearDescriptorCache(EdgeSet edges)
bool hasPath(GraphNode &src, const GraphNode &dest) const
virtual int rootGraphInDegree(const Node &node) const
int maxSourceDistance(const GraphNode &node) const
virtual void moveInEdges(const Node &source, const Node &destination)
void findAllPaths() const
std::set< GraphNode *, typename GraphNode::Comparator > NodeSet
int maxPathLength(const GraphNode &node) const
GraphEdge Edge
The (base) edge type managed by this graph.
boost::graph_traits< Graph > GraphTraits
Traits characterising the internal graph type.
#define IGNORE_CLANG_WARNING(X)
void setName(const TCEString &newName)
virtual void copyInEdge(const Node &destination, Edge &edge, const Node *tail=NULL)
std::set< RemovedEdgeDatum > RemovedEdgeMap
std::vector< std::vector< int > > PathCache
virtual Edge & rootGraphOutEdge(const Node &node, const int index) const
virtual int rootGraphOutDegree(const Node &node) const
virtual void addNode(Node &node)
void sourceDistDecreased(const GraphNode &n) const
BoostGraph & operator=(const BoostGraph &)
Assignment forbidden.
std::map< const GraphNode *, int, typename GraphNode::Comparator > loopingSourceDistances_
virtual void moveOutEdge(const Node &source, const Node &destination, Edge &edge, const Node *head=NULL, bool childs=false)
bool operator<(const PathLengthHelper &other) const
std::map< const GraphNode *, int, typename GraphNode::Comparator > sinkDistances_
virtual void dropNode(Node &node)
bool detectIllegalCycles() const
EdgeDescMap edgeDescriptors_
virtual int outDegree(const Node &node) const
virtual void moveInEdge(const Node &source, const Node &destination, Edge &edge, const Node *tail=NULL, bool childs=false)
virtual void disconnectNodes(const Node &nTail, const Node &nHead)
virtual Edge & rootGraphInEdge(const Node &node, const int index) const
virtual void copyOutEdge(const Node &destination, Edge &edge, const Node *head=NULL)
virtual EdgeSet rootGraphOutEdges(const Node &node) const
std::set< GraphEdge *, typename GraphEdge::Comparator > EdgeSet
virtual void removeNode(Node &node)
std::set< Edge * > ownedEdges_
EdgeDescriptor connectingEdge(const Node &nTail, const Node &nHead) const
virtual Edge & inEdge(const Node &node, const int index) const
hash_map< const Node *, NodeDescriptor, GraphHashFunctions > NodeDescMap
std::vector< BoostGraph< GraphNode, GraphEdge > * > childGraphs_
PathLengthHelper(NodeDescriptor nd, int len, int sd, bool looping=false)
virtual void moveOutEdges(const Node &source, const Node &destination)
virtual int edgeID() const
int maxSinkDistance(const GraphNode &node) const
GraphNode Node
The (base) node type managed by this graph.
virtual NodeSet sinkNodes() const
bool operator<(const RemovedEdgeDatum &other) const
void calculatePathLengthsOnConnect(const GraphNode &nTail, const GraphNode &nHead, GraphEdge &e)
boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, Node *, Edge * > Graph
Internal graph type, providing actual graph-like operations. This type definition relies on bundled p...
GraphTraits::vertex_iterator NodeIter
Iterator type for the list of all nodes in the graph.
GraphTraits::edge_descriptor EdgeDescriptor
Type with which edges of the graph are seen internally.
virtual int inDegree(const Node &node) const
bool hasNode(const Node &) const
GraphTraits::vertex_descriptor NodeDescriptor
Type with which nodes of the graph are seen internally.
virtual EdgeSet inEdges(const Node &node) const
EdgeSet connectingEdges(const Node &nTail, const Node &nHead) const
void detachSubgraph(BoostGraph &subGraph)
hash_map< const Edge *, EdgeDescriptor, GraphHashFunctions > EdgeDescMap
void restoreRemovedEdges(RemovedEdgeMap removedEdges)
void constructSubGraph(BoostGraph &subGraph, NodeSet &nodes)
virtual Edge & edge(const int index) const
virtual EdgeSet outEdges(const Node &node) const
BoostGraph * parentGraph()
bool isInCriticalPath(const GraphNode &node) const
virtual void dropEdge(Edge &edge)
bool operator<(const detail::edge_desc_impl< D, V > &a, const detail::edge_desc_impl< D, V > &b)
void replaceNodeWithLastNode(GraphNode &dest)
void calculatePathLengthsFast() const
GraphTraits::out_edge_iterator OutEdgeIter
Output edge iterator type.
Graph graph_
The internal graph structure.
void sinkDistDecreased(const GraphNode &n) const
NodeDescMap nodeDescriptors_
virtual int edgeWeight(GraphEdge &e, const GraphNode &n) const
RemovedEdgeDatum(GraphNode &tail, GraphNode &head, GraphEdge &e)
BoostGraph(bool allowLoopEdges=true)
virtual NodeSet rootNodes() const
useful utility functions
virtual const TCEString & name() const
BoostGraph< GraphNode, GraphEdge > * parentGraph_
void calculatePathLengths() const
EdgeDescriptor descriptor(const Edge &e) const
size_t operator()(const GraphNode *node) const
virtual NodeSet successors(const Node &node, bool ignoreBackEdges=false, bool ignoreForwardEdges=false) const
virtual EdgeSet rootGraphInEdges(const Node &node) const
GraphTraits::in_edge_iterator InEdgeIter
Input edge iterator type.
GraphTraits::edge_iterator EdgeIter
Iterator type for the list of all edges in the graph.
void calculateSourceDistances(const GraphNode *startNode=NULL, int startingLength=0, bool looping=false) const
void restoreNodeFromParent(GraphNode &node)
EdgeDescriptor edgeDescriptor(const NodeDescriptor &tailNode, const Edge &e) const