1 #ifndef GRAPH_ANALYSIS_BOOST_GRAPH_DIRECTED_GRAPH_HPP 2 #define GRAPH_ANALYSIS_BOOST_GRAPH_DIRECTED_GRAPH_HPP 4 #include "../Graph.hpp" 5 #include "../BaseGraph.hpp" 6 #include "../boost_graph/ArcIterator.hpp" 7 #include <boost/graph/adjacency_list.hpp> 8 #include <base-logging/Logging.hpp> 10 #include <boost/unordered_map.hpp> 16 namespace boost_graph {
20 typedef boost::bidirectionalS
GType;
25 typedef boost::property< boost::vertex_index_t, std::size_t, Vertex::Ptr>
VProp;
26 typedef boost::property< boost::edge_index_t, std::size_t, Edge::Ptr>
EProp;
28 typedef boost::adjacency_list<VRep, ERep, boost::undirectedS, VProp, EProp>
UndirectedGraph;
33 typedef boost::graph_traits<BidirectionalGraph>::vertices_size_type
VertexIndex;
34 typedef std::pair<VertexIterator, VertexIterator>
VertexRange;
36 typedef boost::graph_traits<BidirectionalGraph>::edge_descriptor
EdgeDescriptor;
38 typedef std::pair<EdgeIterator, EdgeIterator>
EdgeRange;
54 typedef shared_ptr<DirectedGraph>
Ptr;
55 typedef boost::unordered_map<GraphElementId, VertexDescriptor>
VertexMap;
56 typedef boost::unordered_map<GraphElementId, EdgeDescriptor>
EdgeMap;
75 void write(std::ostream& ostream = std::cout)
const;
115 std::vector<Edge::Ptr>
getEdges(VertexDescriptor source, VertexDescriptor target)
const;
156 #endif // GRAPH_ANALYSIS_BOOST_DIRECTED_GRAPH_HPP boost::adjacency_list< VRep, ERep, GType, VProp, EProp > BidirectionalGraph
Definition: DirectedGraph.hpp:29
boost::graph_traits< BidirectionalGraph >::vertex_iterator VertexIteratorImpl
Definition: DirectedGraph.hpp:32
boost::graph_traits< BidirectionalGraph >::vertex_descriptor VertexDescriptor
Definition: DirectedGraph.hpp:31
Definition: ArcIterator.hpp:98
SubGraph::Ptr identifyConnectedComponents(const BaseGraph::Ptr &baseGraph) const
Definition: DirectedGraph.cpp:174
uint32_t GraphElementId
Definition: GraphElement.hpp:21
std::pair< VertexIterator, VertexIterator > VertexRange
Definition: DirectedGraph.hpp:34
Definition: TypedGraph.hpp:9
std::pair< EdgeIterator, EdgeIterator > EdgeRange
Definition: DirectedGraph.hpp:38
boost::property< boost::vertex_index_t, std::size_t, Vertex::Ptr > VProp
Definition: DirectedGraph.hpp:25
std::pair< AdjacencyIterator, AdjacencyIterator > AdjacencyRange
Definition: DirectedGraph.hpp:41
Vertex::Ptr getVertex(GraphElementId id) const
Get the vertex by id.
Definition: DirectedGraph.cpp:83
boost::property< boost::edge_index_t, std::size_t, Edge::Ptr > EProp
Definition: DirectedGraph.hpp:26
Definition: ArcIterator.hpp:51
GraphElementId addEdgeInternal(const Edge::Ptr &edge, GraphElementId sourceVertexId, GraphElementId targetVertexId)
Add an edge.
Definition: DirectedGraph.cpp:121
graph_analysis::EdgeIterator::Ptr getOutEdgeIterator(const Vertex::Ptr &vertex) const
Definition: DirectedGraph.cpp:208
boost::unordered_map< GraphElementId, EdgeDescriptor > EdgeMap
Definition: DirectedGraph.hpp:56
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
virtual void removeVertexInternal(const Vertex::Ptr &)
Definition: DirectedGraph.cpp:74
std::vector< Edge::Ptr > getEdges(VertexDescriptor source, VertexDescriptor target) const
Definition: DirectedGraph.cpp:220
DirectedGraph()
Definition: DirectedGraph.cpp:30
VertexIterator::Ptr getVertexIterator() const
Definition: DirectedGraph.cpp:156
EdgeMap mEdgeMap
Definition: DirectedGraph.hpp:147
boost::adjacency_list< VRep, ERep, boost::undirectedS, VProp, EProp > UndirectedGraph
Definition: DirectedGraph.hpp:28
virtual ~DirectedGraph()
Definition: DirectedGraph.cpp:41
VertexMap mVertexMap
Definition: DirectedGraph.hpp:148
VertexDescriptor getVertexDescriptor(const Vertex::Ptr &vertex) const
Definition: DirectedGraph.cpp:97
boost::vecS ERep
Definition: DirectedGraph.hpp:23
DirectedGraph::Ptr validateType(const BaseGraph::Ptr &baseGraph) const
Definition: DirectedGraph.cpp:45
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
BaseGraph::Ptr newInstance() const
Definition: DirectedGraph.cpp:25
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
shared_ptr< DirectedGraph > Ptr
Definition: DirectedGraph.hpp:54
shared_ptr< EdgeIterator > Ptr
Definition: EdgeIterator.hpp:20
boost::graph_traits< BidirectionalGraph >::vertices_size_type VertexIndex
Definition: DirectedGraph.hpp:33
boost::graph_traits< BidirectionalGraph >::edge_iterator EdgeIteratorImpl
Definition: DirectedGraph.hpp:37
static std::map< GraphId, GraphElementId > msNewEdgeId
Definition: DirectedGraph.hpp:150
virtual GraphElementId addVertexInternal(const Vertex::Ptr &vertex)
Add a vertex.
Definition: DirectedGraph.cpp:56
shared_ptr< SubGraph > Ptr
Definition: SubGraph.hpp:52
EdgeDescriptor getEdgeDescriptor(const Edge::Ptr &edge) const
Definition: DirectedGraph.cpp:108
boost::graph_traits< BidirectionalGraph >::edge_descriptor EdgeDescriptor
Definition: DirectedGraph.hpp:36
shared_ptr< VertexIterator > Ptr
Definition: VertexIterator.hpp:21
BaseGraph::Ptr copy() const
Definition: DirectedGraph.cpp:20
boost::bidirectionalS GType
Definition: DirectedGraph.hpp:20
virtual void removeEdgeInternal(const Edge::Ptr &)
Definition: DirectedGraph.cpp:133
void write(std::ostream &ostream=std::cout) const
shared_ptr< BaseGraph > Ptr
Definition: BaseGraph.hpp:34
boost::graph_traits< BidirectionalGraph >::adjacency_iterator AdjacencyIterator
Definition: DirectedGraph.hpp:40
EdgeIterator::Ptr getEdgeIterator() const
Definition: DirectedGraph.cpp:162
Definition: DirectedGraph.hpp:43
static std::map< GraphId, GraphElementId > msNewVertexId
Definition: DirectedGraph.hpp:149
boost::unordered_map< GraphElementId, VertexDescriptor > VertexMap
Definition: DirectedGraph.hpp:55
SubGraph::Ptr createSubGraph(const BaseGraph::Ptr &baseGraph) const
Definition: DirectedGraph.cpp:198
graph_analysis::EdgeIterator::Ptr getInEdgeIterator(const Vertex::Ptr &vertex) const
Definition: DirectedGraph.cpp:214
Edge::Ptr getEdge(GraphElementId id) const
Get the edge by id.
Definition: DirectedGraph.cpp:142
boost::listS VRep
Definition: DirectedGraph.hpp:22