Go to the documentation of this file. 1 #ifndef GRAPH_ANALYSIS_BASE_GRAPH_HPP
2 #define GRAPH_ANALYSIS_BASE_GRAPH_HPP
34 typedef shared_ptr<BaseGraph>
Ptr;
82 virtual BaseGraph::Ptr copy()
const {
throw std::runtime_error(
"BaseGraph::copy: not implemented"); }
230 std::vector< shared_ptr<T> >
edges;
232 while(edgeIt->next())
234 shared_ptr<T> edge = dynamic_pointer_cast<T>( edgeIt->current() );
235 if(edge && edge->getTargetVertex() == target)
237 edges.push_back(edge);
252 std::vector< shared_ptr<T> >
vertices;
254 while(vertexIt->next())
256 shared_ptr<T> vertex = dynamic_pointer_cast<T>( vertexIt->current() );
298 virtual std::vector<Edge::Ptr>
getAllEdges()
const;
413 std::set<BaseGraphObserver::Ptr> mObservers;
422 #endif // GRAPH_ANALYSIS_BASE_GRAPH_HPP
static SubGraph::Ptr applyFilters(const Ptr &graph, const Filter< Vertex::Ptr >::Ptr &vertexFilter, const Filter< Edge::Ptr >::Ptr &edgeFilter)
Definition: BaseGraph.cpp:364
Definition: VertexIterable.hpp:8
virtual BaseIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr > edges()
Definition: BaseGraph.hpp:284
void clear()
Definition: BaseGraph.cpp:375
@ IMPLEMENTATION_TYPE_END
Definition: BaseGraph.hpp:31
void removeVertex(const Vertex::Ptr &vertex)
Remove vertex In order to reimplement, call the base function first BaseGraph::addVertex(v)
Definition: BaseGraph.cpp:181
@ LEMON_DIRECTED_GRAPH
Definition: BaseGraph.hpp:31
virtual GraphElementId addVertexInternal(const Vertex::Ptr &)
Definition: BaseGraph.hpp:375
GraphElementId addVertex(const Vertex::Ptr &vertex)
Add a vertex.
Definition: BaseGraph.cpp:166
virtual SubGraph::Ptr createSubGraph(const Ptr &baseGraph) const
Definition: BaseGraph.hpp:400
virtual std::vector< Edge::Ptr > getAllEdges() const
Definition: BaseGraph.cpp:328
General Graph template that should be implemented to wrap specific graph library functionality We ass...
Definition: BaseGraph.hpp:27
Definition: BaseIterable.hpp:13
uint32_t GraphId
Definition: GraphElement.hpp:22
virtual EdgeIterator::Ptr getOutEdgeIterator(const Vertex::Ptr &vertex) const
Definition: BaseGraph.hpp:333
GraphElementId addHyperEdge(const HyperEdge::Ptr &hyperEdge)
Definition: BaseGraph.hpp:182
size_t order() const
Definition: BaseGraph.hpp:327
@ SNAP_DIRECTED_GRAPH
Definition: BaseGraph.hpp:31
Definition: EdgeIterable.hpp:8
std::vector< Edge::Ptr > getOutEdges(const Vertex::Ptr &vertex) const
Definition: BaseGraph.cpp:417
std::vector< shared_ptr< T > > getVertices() const
Get all vertices of a given type Type should be a subclass of vertex If dynamic_pointer_cast returns ...
Definition: BaseGraph.hpp:250
virtual EdgeIterator::Ptr getEdgeIterator(const Vertex::Ptr &vertex) const
Definition: BaseGraph.hpp:304
ImplementationType getImplementationType() const
Definition: BaseGraph.hpp:113
shared_ptr< BaseGraphObserver > Ptr
Definition: BaseGraphObserver.hpp:39
shared_ptr< FilterType > Ptr
Definition: Filter.hpp:59
virtual std::vector< Edge::Ptr > getEdges(const Vertex::Ptr &source, const Vertex::Ptr &target) const
Get edge by given vertices.
Definition: BaseGraph.cpp:262
bool isDirected() const
Definition: BaseGraph.hpp:362
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
shared_ptr< BaseGraph > Ptr
Definition: BaseGraph.hpp:34
GraphElementId getEdgeId(const Edge::Ptr &edge) const
Get the edge id for this graph.
Definition: BaseGraph.hpp:206
void removeObserver(const BaseGraphObserver::Ptr &observer)
Definition: BaseGraph.cpp:50
std::vector< shared_ptr< T > > getEdges(const Vertex::Ptr &source, const Vertex::Ptr &target) const
Get edges by given vertices and return only edges of a given type that end at target Type should be a...
Definition: BaseGraph.hpp:228
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
GraphId getId() const
Definition: BaseGraph.hpp:270
static Ptr getInstance(ImplementationType type=LEMON_DIRECTED_GRAPH)
Definition: BaseGraph.cpp:26
virtual Edge::Ptr getEdge(GraphElementId id) const
Get the edge by id.
Definition: BaseGraph.hpp:212
virtual ~BaseGraph()
Default deconstructor.
Definition: BaseGraph.hpp:39
virtual void removeVertexInternal(const Vertex::Ptr &)
Definition: BaseGraph.hpp:381
void transactionEvent(TransactionType eventType)
issue a transaction event The transaction event is passed to all observers, which can implement the r...
Definition: BaseGraph.cpp:88
virtual EdgeIterator::Ptr getEdgeIterator() const
Definition: BaseGraph.hpp:283
bool empty() const
tests whether the graph is void/empty
Definition: BaseGraph.cpp:400
GraphElementId addEdge(const Edge::Ptr &edge)
Add an edge Cannot be reimplemented directly, but see addEdge(Edge::Ptr, GraphElementId,...
Definition: BaseGraph.cpp:194
ImplementationType
Definition: BaseGraph.hpp:31
virtual Vertex::Ptr getVertex(GraphElementId id) const
Get the vertex by id.
Definition: BaseGraph.hpp:150
size_t size() const
Definition: BaseGraph.hpp:321
virtual std::vector< Vertex::Ptr > getAllVertices() const
Definition: BaseGraph.cpp:317
uint32_t GraphElementId
Definition: GraphElement.hpp:21
virtual VertexIterator::Ptr getVertexIterator() const
Definition: BaseGraph.hpp:276
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
void removeEdge(const Edge::Ptr &edge)
Definition: BaseGraph.cpp:249
bool contains(const Edge::Ptr &edge) const
Definition: BaseGraph.cpp:339
virtual BaseGraph::Ptr copy() const
Definition: BaseGraph.hpp:82
std::string getImplementationTypeName() const
Definition: BaseGraph.hpp:119
static std::map< ImplementationType, std::string > ImplementationTypeTxt
Definition: BaseGraph.hpp:32
virtual EdgeIterator::Ptr getInEdgeIterator(const Vertex::Ptr &vertex) const
Definition: BaseGraph.hpp:339
SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > inEdges(const Vertex::Ptr &vertex) const
Definition: BaseGraph.cpp:429
virtual void removeEdgeInternal(const Edge::Ptr &)
Definition: BaseGraph.hpp:394
BaseGraph::Ptr cloneEdges() const
Definition: BaseGraph.cpp:136
TransactionType
Transaction events These events are triggers for the notification system to allow transactions to be ...
Definition: BaseGraphObserver.hpp:27
std::vector< Edge::Ptr > getInEdges(const Vertex::Ptr &vertex) const
Definition: BaseGraph.cpp:406
void addObserver(const BaseGraphObserver::Ptr &observer)
Definition: BaseGraph.cpp:45
BaseGraph(ImplementationType type, bool directed)
Definition: BaseGraph.cpp:19
bool isUndirected() const
Definition: BaseGraph.hpp:357
BaseGraph::Ptr clone() const
Definition: BaseGraph.cpp:93
Definition: BaseIterable.hpp:126
shared_ptr< HyperEdge > Ptr
Definition: HyperEdge.hpp:20
shared_ptr< SubGraph > Ptr
Definition: SubGraph.hpp:52
virtual GraphElementId addEdgeInternal(const Edge::Ptr &edge, GraphElementId sourceVertexId, GraphElementId edgeVertexId)
Definition: BaseGraph.hpp:388
virtual BaseIterable< VertexIterator::Ptr, BaseGraph, Vertex::Ptr > vertices()
Definition: BaseGraph.hpp:277
SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > outEdges(const Vertex::Ptr &vertex) const
Definition: BaseGraph.cpp:434
shared_ptr< EdgeIterator > Ptr
Definition: EdgeIterator.hpp:20
@ BOOST_DIRECTED_GRAPH
Definition: BaseGraph.hpp:31
shared_ptr< VertexIterator > Ptr
Definition: VertexIterator.hpp:21
GraphElementId getVertexId(const Vertex::Ptr &vertex) const
Get the vertex id for this graph.
Definition: BaseGraph.hpp:144
Interface definition for a collection of standard algorithms.
Definition: Algorithms.hpp:14
EventType
Types of events for the observer. Example: notify(vertex, EVENT_TYPE_ADDED, ...) is called whenever a...
Definition: BaseGraphObserver.hpp:15
virtual size_t removeEdges(const Vertex::Ptr &a, const Vertex::Ptr &b)
Definition: BaseGraph.cpp:291
virtual BaseGraph::Ptr newInstance() const
Definition: BaseGraph.hpp:98
void removeHyperEdge(const HyperEdge::Ptr &hyperEdge)
Definition: BaseGraph.hpp:188
static SubGraph::Ptr getSubGraph(const Ptr &graph)
Definition: BaseGraph.cpp:161