|
graph_analysis
|
General Graph template that should be implemented to wrap specific graph library functionality We assume that all graph implementations will rely and allow access to vertices and edges via integers. More...
#include <BaseGraph.hpp>


Public Types | |
| enum | ImplementationType { BOOST_DIRECTED_GRAPH, LEMON_DIRECTED_GRAPH, SNAP_DIRECTED_GRAPH, IMPLEMENTATION_TYPE_END } |
| typedef shared_ptr< BaseGraph > | Ptr |
Public Member Functions | |
| virtual | ~BaseGraph () |
| Default deconstructor. More... | |
| void | addObserver (const BaseGraphObserver::Ptr &observer) |
| void | removeObserver (const BaseGraphObserver::Ptr &observer) |
| void | transactionEvent (TransactionType eventType) |
| issue a transaction event The transaction event is passed to all observers, which can implement the respective response to the transaction. E.g. rollback, hold-and-forward, etc. More... | |
| virtual BaseGraph::Ptr | copy () const |
| BaseGraph::Ptr | clone () const |
| BaseGraph::Ptr | cloneEdges () const |
| virtual BaseGraph::Ptr | newInstance () const |
| ImplementationType | getImplementationType () const |
| std::string | getImplementationTypeName () const |
| bool | empty () const |
| tests whether the graph is void/empty More... | |
| GraphElementId | addVertex (const Vertex::Ptr &vertex) |
| Add a vertex. More... | |
| GraphElementId | getVertexId (const Vertex::Ptr &vertex) const |
| Get the vertex id for this graph. More... | |
| virtual Vertex::Ptr | getVertex (GraphElementId id) const |
| Get the vertex by id. More... | |
| void | removeVertex (const Vertex::Ptr &vertex) |
| Remove vertex In order to reimplement, call the base function first BaseGraph::addVertex(v) More... | |
| GraphElementId | addEdge (const Edge::Ptr &edge) |
| Add an edge Cannot be reimplemented directly, but see addEdge(Edge::Ptr, GraphElementId, GraphElementId) More... | |
| void | removeEdge (const Edge::Ptr &edge) |
| virtual size_t | removeEdges (const Vertex::Ptr &a, const Vertex::Ptr &b) |
| GraphElementId | addHyperEdge (const HyperEdge::Ptr &hyperEdge) |
| void | removeHyperEdge (const HyperEdge::Ptr &hyperEdge) |
| bool | contains (const Edge::Ptr &edge) const |
| bool | contains (const Vertex::Ptr &vertex) const |
| GraphElementId | getEdgeId (const Edge::Ptr &edge) const |
| Get the edge id for this graph. More... | |
| virtual Edge::Ptr | getEdge (GraphElementId id) const |
| Get the edge by id. More... | |
| virtual std::vector< Edge::Ptr > | getEdges (const Vertex::Ptr &source, const Vertex::Ptr &target) const |
| Get edge by given vertices. More... | |
| template<typename T > | |
| 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 subclass of Edge!! If dynamic_pointer_cast returns null pointer, object is not added. More... | |
| template<typename T > | |
| 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 null pointer, object is not added. More... | |
| GraphId | getId () const |
| virtual VertexIterator::Ptr | getVertexIterator () const |
| virtual BaseIterable< VertexIterator::Ptr, BaseGraph, Vertex::Ptr > | vertices () |
| virtual EdgeIterator::Ptr | getEdgeIterator () const |
| virtual BaseIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr > | edges () |
| virtual std::vector< Vertex::Ptr > | getAllVertices () const |
| virtual std::vector< Edge::Ptr > | getAllEdges () const |
| virtual EdgeIterator::Ptr | getEdgeIterator (const Vertex::Ptr &vertex) const |
| void | clear () |
| size_t | size () const |
| size_t | order () const |
| virtual EdgeIterator::Ptr | getOutEdgeIterator (const Vertex::Ptr &vertex) const |
| virtual EdgeIterator::Ptr | getInEdgeIterator (const Vertex::Ptr &vertex) const |
| std::vector< Edge::Ptr > | getInEdges (const Vertex::Ptr &vertex) const |
| std::vector< Edge::Ptr > | getOutEdges (const Vertex::Ptr &vertex) const |
| SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > | inEdges (const Vertex::Ptr &vertex) const |
| SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > | outEdges (const Vertex::Ptr &vertex) const |
| bool | isUndirected () const |
| bool | isDirected () const |
Public Member Functions inherited from graph_analysis::VertexIterable | |
| virtual | ~VertexIterable () |
| virtual uint64_t | getVertexCount () const |
Public Member Functions inherited from graph_analysis::EdgeIterable | |
| virtual | ~EdgeIterable () |
| virtual uint64_t | getEdgeCount () const |
Public Member Functions inherited from graph_analysis::Algorithms | |
| virtual | ~Algorithms () |
| virtual shared_ptr< SubGraph > | identifyConnectedComponents (const shared_ptr< BaseGraph > &baseGraph) const |
| virtual bool | isConnected () const |
Static Public Member Functions | |
| static Ptr | getInstance (ImplementationType type=LEMON_DIRECTED_GRAPH) |
| static SubGraph::Ptr | getSubGraph (const Ptr &graph) |
| static SubGraph::Ptr | applyFilters (const Ptr &graph, const Filter< Vertex::Ptr >::Ptr &vertexFilter, const Filter< Edge::Ptr >::Ptr &edgeFilter) |
Static Public Attributes | |
| static std::map< ImplementationType, std::string > | ImplementationTypeTxt |
Protected Member Functions | |
| BaseGraph (ImplementationType type, bool directed) | |
| virtual GraphElementId | addVertexInternal (const Vertex::Ptr &) |
| virtual void | removeVertexInternal (const Vertex::Ptr &) |
| virtual GraphElementId | addEdgeInternal (const Edge::Ptr &edge, GraphElementId sourceVertexId, GraphElementId edgeVertexId) |
| virtual void | removeEdgeInternal (const Edge::Ptr &) |
| virtual SubGraph::Ptr | createSubGraph (const Ptr &baseGraph) const |
General Graph template that should be implemented to wrap specific graph library functionality We assume that all graph implementations will rely and allow access to vertices and edges via integers.
| typedef shared_ptr<BaseGraph> graph_analysis::BaseGraph::Ptr |
|
inlinevirtual |
Default deconstructor.
|
protected |
Default constructor for a graph
| GraphElementId graph_analysis::BaseGraph::addEdge | ( | const Edge::Ptr & | edge | ) |
Add an edge Cannot be reimplemented directly, but see addEdge(Edge::Ptr, GraphElementId, GraphElementId)
|
inlineprotectedvirtual |
Add an edge using source and target vertex on the internal graph representation
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::boost_graph::DirectedGraph, and graph_analysis::snap::DirectedGraph.
|
inline |
Utility function to add a hyper edge (internally handled as vertex)
| void graph_analysis::BaseGraph::addObserver | ( | const BaseGraphObserver::Ptr & | observer | ) |
Add an observer to the set of observers (see BaseGraphObserver.hpp)
| GraphElementId graph_analysis::BaseGraph::addVertex | ( | const Vertex::Ptr & | vertex | ) |
Add a vertex.
The base implementation does not add the vertex to the graph, but checks only if the vertex is already associated with the graph. Reimplement for the specific graph implementation and call the base function first, i.e. BaseGraph::addVertex(v)
| std::runtime_error | if the vertex already exists in the graph |
|
inlineprotectedvirtual |
Add a vertex from the internal graph representation
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::boost_graph::DirectedGraph, and graph_analysis::snap::DirectedGraph.
|
static |
Apply filters to base graph
Apply filters to base graph
| void graph_analysis::BaseGraph::clear | ( | ) |
Clear the graph from all nodes and edges
| BaseGraph::Ptr graph_analysis::BaseGraph::clone | ( | ) | const |
Clone the graph, i.e. provides a deep copy of this graph so that this graph and the clone do not share any references
| BaseGraph::Ptr graph_analysis::BaseGraph::cloneEdges | ( | ) | const |
Copy the vertices, but clone the edges of the graph
| bool graph_analysis::BaseGraph::contains | ( | const Edge::Ptr & | edge | ) | const |
Test if graph contains this edge
| bool graph_analysis::BaseGraph::contains | ( | const Vertex::Ptr & | vertex | ) | const |
Test if graph contains this vertex
|
inlinevirtual |
Create a copy of this graph The copy of the graph and this graph will still share the same set of edges and vertices. If you require complete separation consider calling clone
Reimplemented in graph_analysis::snap::DirectedGraph, graph_analysis::boost_graph::DirectedGraph, and graph_analysis::lemon::DirectedGraph.
|
inlineprotectedvirtual |
Create subgraph of the given baseGraph
| baseGraph | BaseGraph that this subgraph is related to |
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::snap::DirectedGraph, and graph_analysis::boost_graph::DirectedGraph.
|
inlinevirtual |
| bool graph_analysis::BaseGraph::empty | ( | ) | const |
tests whether the graph is void/empty
|
virtual |
Retrieve all edges The default implementation uses the iterator, thus requires O(|edges|)
|
virtual |
Retrieve all vertices This default implementation uses the iterator, thus requires O(|vertices|)
|
inlinevirtual |
Get the edge by id.
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::snap::DirectedGraph, and graph_analysis::boost_graph::DirectedGraph.
|
inline |
Get the edge id for this graph.
| std::runtime_error | if the edge is not part of this graph |
|
inlinevirtual |
Get iterator over all edges in this graph
Reimplemented from graph_analysis::EdgeIterable.
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::snap::DirectedGraph, and graph_analysis::boost_graph::DirectedGraph.
|
inlinevirtual |
Get iterator over all edges (in/out) from the given vertex
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::snap::DirectedGraph, and graph_analysis::boost_graph::DirectedGraph.
|
virtual |
Get edge by given vertices.
Reimplemented in graph_analysis::boost_graph::DirectedGraph.
|
inline |
Get edges by given vertices and return only edges of a given type that end at target Type should be a subclass of Edge!! If dynamic_pointer_cast returns null pointer, object is not added.
|
inline |
Get the graph id
|
inline |
Get the implementation type of this graph object
|
inline |
Get the implementation type as string
|
inlinevirtual |
Get in edge iterator If the graph is undirected will return the same iterator as getEdgeIterator
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::snap::DirectedGraph, and graph_analysis::boost_graph::DirectedGraph.
| std::vector< Edge::Ptr > graph_analysis::BaseGraph::getInEdges | ( | const Vertex::Ptr & | vertex | ) | const |
Get all in edges of a vertex as list
|
static |
Get a graph instance of the given implementation type
|
inlinevirtual |
Get out edge iterator If the graph is undirected will return the same iterator as getEdgeIterator
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::boost_graph::DirectedGraph, and graph_analysis::snap::DirectedGraph.
| std::vector< Edge::Ptr > graph_analysis::BaseGraph::getOutEdges | ( | const Vertex::Ptr & | vertex | ) | const |
Get all out edges of a vertex as list
|
static |
Get the subgraph for a graph. To support this feature implementation have to provide an implementation of BaseGraph::createSubGraph
|
inlinevirtual |
Get the vertex by id.
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::snap::DirectedGraph, and graph_analysis::boost_graph::DirectedGraph.
|
inline |
Get the vertex id for this graph.
| std::runtime_error | if the vertex is not part of this graph |
|
inlinevirtual |
Get the iterator over all vertices in this graph
Reimplemented from graph_analysis::VertexIterable.
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::snap::DirectedGraph, and graph_analysis::boost_graph::DirectedGraph.
|
inline |
Get all vertices of a given type Type should be a subclass of vertex If dynamic_pointer_cast returns null pointer, object is not added.
| SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > graph_analysis::BaseGraph::inEdges | ( | const Vertex::Ptr & | vertex | ) | const |
|
inline |
Test if graph is directed
|
inline |
Test if graph is undirected
|
inlinevirtual |
Allow to create an instance of the same type of graph
Reimplemented in graph_analysis::snap::DirectedGraph, graph_analysis::boost_graph::DirectedGraph, and graph_analysis::lemon::DirectedGraph.
|
inline |
Get the order of the graph, i.e. by definition the number of vertices in the graph
| SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > graph_analysis::BaseGraph::outEdges | ( | const Vertex::Ptr & | vertex | ) | const |
| void graph_analysis::BaseGraph::removeEdge | ( | const Edge::Ptr & | edge | ) |
Remove an edge and disassociate from this graph In order to reimplement, call the base function first BaseGraph::addVertex(v)
|
inlineprotectedvirtual |
Remove an edge from the internal graph representation
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::boost_graph::DirectedGraph, and graph_analysis::snap::DirectedGraph.
|
virtual |
Remove edges which link two vertices
|
inline |
Utility function to remove a hyper edge (internally handled as vertex) Remove hyper edge
| void graph_analysis::BaseGraph::removeObserver | ( | const BaseGraphObserver::Ptr & | observer | ) |
Removes an observer from the set of observers.
| void graph_analysis::BaseGraph::removeVertex | ( | const Vertex::Ptr & | vertex | ) |
Remove vertex In order to reimplement, call the base function first BaseGraph::addVertex(v)
|
inlineprotectedvirtual |
Remove a vertex from the internal graph representation
Reimplemented in graph_analysis::lemon::DirectedGraph, graph_analysis::boost_graph::DirectedGraph, and graph_analysis::snap::DirectedGraph.
|
inline |
Get size of the graph, i.e. by definition the number of edges in the graph
| void graph_analysis::BaseGraph::transactionEvent | ( | TransactionType | eventType | ) |
issue a transaction event The transaction event is passed to all observers, which can implement the respective response to the transaction. E.g. rollback, hold-and-forward, etc.
Any combined actions like e.g. loading of files a.s.o. should have a
transactionsEvent( TRANSACTION_START ); ... // modify graph vertices and edges ... transactionEvent( TRANSACTION_STOP );
bracket,
|
inlinevirtual |
|
static |
1.8.13