This is a implementation of a Bidirectional Graph. By convention a bidirectional graph provides access to out-and in edges. More...
#include <BidirectionalGraph.h>
Public Member Functions | |
| BidirectionalGraph () | |
| constructor. More... | |
| BidirectionalGraph (GraphMetadata *metadata) | |
| Constructor. More... | |
| BidirectionalGraph (AbstractCachePolicy *cp, AbstractGraphLoaderStrategy *ls) | |
| Constructor. More... | |
| virtual void | flush () |
| Function used to clear the memory cache, all elements was released from memory, if any element was changes it will be saved. More... | |
| virtual te::graph::GraphMetadata * | getMetadata () |
| Function used to access the graph metadata. More... | |
| ~BidirectionalGraph () | |
| Virtual destructor. More... | |
Vertex Access Methods | |
Method used to access vertex elements from a graph. | |
| virtual std::vector< te::graph::Vertex * > | getVertexNeighborhood (int id) |
| The neighborhood of a vertex v is an induced subgraph of the graph, formed by all vertices adjacent to v. More... | |
| virtual bool | isIsolateVertex (int id, bool &flag) |
| This function indicates if a desired element is a isolated vertex. More... | |
| virtual bool | isSourceVertex (int id, bool &flag) |
| This function indicates if a desired element is a source vertex. More... | |
| virtual bool | isSinkVertex (int id, bool &flag) |
| This function indicates if a desired element is a sink vertex. More... | |
Edge Access Methods | |
Method used to access edge elements from a graph. | |
| virtual void | add (Edge *e) |
| Add a new edge element to a graph. More... | |
| virtual void | removeEdge (int id) |
| This function removes the edge element from graph, also was removed in data source. More... | |
| virtual std::vector< te::graph::Edge * > | getInEdges (int vId) |
| It returns all edges that came in a vertex. More... | |
| virtual std::vector< te::graph::Edge * > | getOutEdges (int vId) |
| It returns all edges that came out a vertex. More... | |
Vertex Access Methods | |
Method used to access vertex elements from a graph. | |
| virtual void | add (Vertex *v) |
| Add a new vertex element to a graph. More... | |
| virtual void | update (Vertex *v) |
| Update the vertex element. More... | |
| virtual void | removeVertex (int id) |
| This function removes the vertex element from graph, also was removed in data source. More... | |
| virtual te::graph::Vertex * | getVertex (int id) |
| It returns the vertex element if it's exist. More... | |
| virtual void | addVertexProperty (te::dt::Property *p) |
| Add a new property associated to the vertex element. More... | |
| virtual void | removeVertexProperty (int idx) |
| Remove a property associated to the vertex element. More... | |
| virtual te::dt::Property * | getVertexProperty (int idx) |
| Get a vertex property given a index. More... | |
| virtual int | getVertexPropertySize () |
| Used to verify the number of properties associated to vertex elements. More... | |
Edge Access Methods | |
Method used to access edge elements from a graph. | |
| virtual void | update (Edge *e) |
| Update the edge element. More... | |
| virtual te::graph::Edge * | getEdge (int id) |
| It returns the edge element if it's exist. More... | |
| virtual void | addEdgeProperty (te::dt::Property *p) |
| Add a new property associated to the edge element. More... | |
| virtual void | removeEdgeProperty (int idx) |
| Remove a property associated to the edge element. More... | |
| virtual te::dt::Property * | getEdgeProperty (int idx) |
| Get a edge property given a index. More... | |
| virtual int | getEdgePropertySize () |
| Used to verify the number of properties associated to edge elements. More... | |
Public Attributes | |
| GraphData * | m_graphData |
| This class has the graph data and properties. More... | |
Protected Attributes | |
| GraphDataManager * | m_dataManager |
| Used to load and save GraphData information from a DataSource. More... | |
| GraphCache * | m_graphCache |
| Class used to keep all graph data loaded. More... | |
| GraphMetadata * | m_metadata |
| Graph Data loader strategy. More... | |
This is a implementation of a Bidirectional Graph. By convention a bidirectional graph provides access to out-and in edges.
Definition at line 56 of file BidirectionalGraph.h.
| te::graph::BidirectionalGraph::BidirectionalGraph | ( | ) |
constructor.
Definition at line 43 of file BidirectionalGraph.cpp.
| te::graph::BidirectionalGraph::BidirectionalGraph | ( | GraphMetadata * | metadata | ) |
Constructor.
| metadata | A pointer to a graph metadata implementation |
Definition at line 47 of file BidirectionalGraph.cpp.
| te::graph::BidirectionalGraph::BidirectionalGraph | ( | AbstractCachePolicy * | cp, |
| AbstractGraphLoaderStrategy * | ls | ||
| ) |
Constructor.
| cp | A pointer to a cache policy implementation |
| ls | A pointer to a loader strategy implementation |
Definition at line 52 of file BidirectionalGraph.cpp.
References ~BidirectionalGraph().
|
default |
Virtual destructor.
Referenced by BidirectionalGraph().
|
virtualinherited |
Add a new vertex element to a graph.
| v | Vertex element |
Implements te::graph::AbstractGraph.
Definition at line 101 of file Graph.cpp.
References te::graph::GraphData::addVertex(), te::graph::GraphCache::getGraphData(), te::graph::GraphData::getVertexMap(), te::graph::Graph::m_graphCache, te::graph::Graph::m_graphData, te::graph::GraphMetadata::m_maxCacheSize, te::graph::GraphMetadata::m_memoryGraph, and te::graph::Graph::m_metadata.
Referenced by te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), and add().
|
virtual |
Add a new edge element to a graph.
| e | Edge element |
Reimplemented from te::graph::Graph.
Definition at line 163 of file BidirectionalGraph.cpp.
References te::graph::Graph::add(), te::graph::GraphCache::checkCacheByVertexId(), te::graph::Edge::getId(), te::graph::Edge::getIdFrom(), te::graph::Edge::getIdTo(), te::graph::Vertex::getPredecessors(), te::graph::Vertex::getSuccessors(), te::graph::Graph::getVertex(), te::graph::Graph::m_graphCache, te::graph::Graph::m_graphData, te::graph::GraphMetadata::m_memoryGraph, and te::graph::Graph::m_metadata.
|
virtualinherited |
Add a new property associated to the edge element.
param p New property to be associated with edge elements.
Implements te::graph::AbstractGraph.
Definition at line 257 of file Graph.cpp.
References te::graph::GraphMetadata::addEdgeProperty(), and te::graph::Graph::m_metadata.
|
virtualinherited |
Add a new property associated to the vertex element.
param p New property to be associated with vertex elements.
Implements te::graph::AbstractGraph.
Definition at line 161 of file Graph.cpp.
References te::graph::GraphMetadata::addVertexProperty(), and te::graph::Graph::m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
|
virtualinherited |
Function used to clear the memory cache, all elements was released from memory, if any element was changes it will be saved.
Implements te::graph::AbstractGraph.
Definition at line 298 of file Graph.cpp.
References te::graph::GraphCache::clearCache(), te::graph::Graph::m_graphCache, te::graph::Graph::m_graphData, te::graph::GraphMetadata::m_memoryGraph, and te::graph::Graph::m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute(), and te::graph::Graph::~Graph().
|
virtualinherited |
It returns the edge element if it's exist.
| id | Vertex identification |
Implements te::graph::AbstractGraph.
Definition at line 237 of file Graph.cpp.
References te::graph::GraphData::getEdge(), te::graph::GraphCache::getGraphDataByEdgeId(), te::graph::Graph::m_graphCache, te::graph::Graph::m_graphData, te::graph::GraphMetadata::m_memoryGraph, and te::graph::Graph::m_metadata.
Referenced by te::graph::AddDeepAttribute::calculateDeepValue(), te::graph::UndirectedGraph::getEdges(), getInEdges(), te::graph::DirectedGraph::getOutEdges(), getOutEdges(), te::graph::GetSubGraph::getPredecessor(), te::graph::GetSubGraph::GetSubGraph(), te::graph::DirectedGraph::getVertexNeighborhood(), getVertexNeighborhood(), te::graph::UndirectedGraph::getVertexNeighborhood(), te::graph::DirectedGraph::removeEdge(), te::graph::UndirectedGraph::removeEdge(), and removeEdge().
|
virtualinherited |
Get a edge property given a index.
| idx | Index of the property |
Implements te::graph::AbstractGraph.
Definition at line 273 of file Graph.cpp.
References te::graph::GraphMetadata::getEdgeProperty(), and te::graph::Graph::m_metadata.
|
virtualinherited |
Used to verify the number of properties associated to edge elements.
Implements te::graph::AbstractGraph.
Definition at line 283 of file Graph.cpp.
References te::graph::GraphMetadata::getEdgePropertySize(), and te::graph::Graph::m_metadata.
|
virtual |
It returns all edges that came in a vertex.
| vId | The attribute used to identify the vertex element |
Definition at line 248 of file BidirectionalGraph.cpp.
References te::graph::Graph::getEdge(), te::graph::Vertex::getPredecessors(), and te::graph::Graph::getVertex().
|
virtualinherited |
Function used to access the graph metadata.
Implements te::graph::AbstractGraph.
Definition at line 293 of file Graph.cpp.
References te::graph::Graph::m_metadata.
|
virtual |
It returns all edges that came out a vertex.
| vId | The attribute used to identify the vertex element |
Definition at line 274 of file BidirectionalGraph.cpp.
References te::graph::Graph::getEdge(), te::graph::Vertex::getSuccessors(), and te::graph::Graph::getVertex().
|
virtualinherited |
It returns the vertex element if it's exist.
| id | Vertex identification |
Implements te::graph::AbstractGraph.
Definition at line 141 of file Graph.cpp.
References te::graph::GraphCache::getGraphDataByVertexId(), te::graph::GraphData::getVertex(), te::graph::Graph::m_graphCache, te::graph::Graph::m_graphData, te::graph::GraphMetadata::m_memoryGraph, and te::graph::Graph::m_metadata.
Referenced by te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), add(), te::graph::AddDeepAttribute::calculateDeepValue(), te::graph::UndirectedGraph::getEdges(), getInEdges(), te::graph::DirectedGraph::getOutEdges(), getOutEdges(), te::graph::GetSubGraph::getPredecessor(), te::graph::GetSubGraph::GetSubGraph(), te::graph::DirectedGraph::getVertexNeighborhood(), getVertexNeighborhood(), te::graph::UndirectedGraph::getVertexNeighborhood(), isIsolateVertex(), te::graph::UndirectedGraph::isIsolateVertex(), te::graph::DirectedGraph::isSinkVertex(), isSinkVertex(), isSourceVertex(), te::graph::DirectedGraph::removeEdge(), te::graph::UndirectedGraph::removeEdge(), and removeEdge().
|
virtual |
The neighborhood of a vertex v is an induced subgraph of the graph, formed by all vertices adjacent to v.
| id | The attribute used to identify the vertex element |
Definition at line 59 of file BidirectionalGraph.cpp.
References te::graph::Graph::getEdge(), te::graph::Edge::getIdFrom(), te::graph::Edge::getIdTo(), te::graph::Vertex::getPredecessors(), te::graph::Vertex::getSuccessors(), and te::graph::Graph::getVertex().
|
virtualinherited |
Get a vertex property given a index.
| idx | Index of the property |
Implements te::graph::AbstractGraph.
Definition at line 177 of file Graph.cpp.
References te::graph::GraphMetadata::getVertexProperty(), and te::graph::Graph::m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
|
virtualinherited |
Used to verify the number of properties associated to vertex elements.
Implements te::graph::AbstractGraph.
Definition at line 187 of file Graph.cpp.
References te::graph::GraphMetadata::getVertexPropertySize(), and te::graph::Graph::m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
This function indicates if a desired element is a isolated vertex.
| id | The attribute used to identify the vertex element |
| flag | Flag used to indicating if the element is a isolated vertex. |
Definition at line 100 of file BidirectionalGraph.cpp.
References te::graph::Vertex::getPredecessors(), te::graph::Vertex::getSuccessors(), and te::graph::Graph::getVertex().
This function indicates if a desired element is a sink vertex.
| id | The attribute used to identify the vertex element |
| flag | Flag used to indicating if the element is a sink vertex. |
Definition at line 142 of file BidirectionalGraph.cpp.
References te::graph::Vertex::getSuccessors(), and te::graph::Graph::getVertex().
This function indicates if a desired element is a source vertex.
| id | The attribute used to identify the vertex element |
| flag | Flag used to indicating if the element is a source vertex. |
Definition at line 121 of file BidirectionalGraph.cpp.
References te::graph::Vertex::getPredecessors(), and te::graph::Graph::getVertex().
|
virtual |
This function removes the edge element from graph, also was removed in data source.
| id | Edge identification |
Reimplemented from te::graph::Graph.
Definition at line 196 of file BidirectionalGraph.cpp.
References te::graph::Graph::getEdge(), te::graph::Edge::getIdFrom(), te::graph::Edge::getIdTo(), te::graph::Vertex::getPredecessors(), te::graph::Vertex::getSuccessors(), te::graph::Graph::getVertex(), and te::graph::Graph::removeEdge().
|
virtualinherited |
Remove a property associated to the edge element.
| idx | Index of the property |
Implements te::graph::AbstractGraph.
Definition at line 265 of file Graph.cpp.
References te::graph::Graph::m_metadata, and te::graph::GraphMetadata::removeEdgeProperty().
|
virtualinherited |
This function removes the vertex element from graph, also was removed in data source.
| id | Vertex identification |
Implements te::graph::AbstractGraph.
Definition at line 123 of file Graph.cpp.
References te::graph::GraphCache::getGraphDataByVertexId(), te::graph::Graph::m_dataManager, te::graph::Graph::m_graphCache, te::graph::Graph::m_graphData, te::graph::GraphMetadata::m_memoryGraph, te::graph::Graph::m_metadata, te::graph::GraphData::removeVertex(), and te::graph::GraphDataManager::removeVertex().
|
virtualinherited |
Remove a property associated to the vertex element.
| idx | Index of the property |
Implements te::graph::AbstractGraph.
Definition at line 169 of file Graph.cpp.
References te::graph::Graph::m_metadata, and te::graph::GraphMetadata::removeVertexProperty().
|
virtualinherited |
Update the vertex element.
| v | Vertex element |
Implements te::graph::AbstractGraph.
Definition at line 116 of file Graph.cpp.
References te::graph::Graph::m_graphData, te::graph::GraphData::setDirty(), and te::graph::Vertex::setDirty().
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
|
virtualinherited |
Update the edge element.
| e | Edge element |
Implements te::graph::AbstractGraph.
Definition at line 212 of file Graph.cpp.
References te::graph::Graph::m_graphData, te::graph::GraphData::setDirty(), and te::graph::Edge::setDirty().
|
protectedinherited |
Used to load and save GraphData information from a DataSource.
Definition at line 290 of file Graph.h.
Referenced by te::graph::Graph::Graph(), te::graph::Graph::removeEdge(), te::graph::Graph::removeVertex(), and te::graph::Graph::~Graph().
|
protectedinherited |
Class used to keep all graph data loaded.
Definition at line 292 of file Graph.h.
Referenced by te::graph::Graph::add(), te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), add(), te::graph::Graph::flush(), te::graph::Graph::getEdge(), te::graph::Graph::getVertex(), te::graph::Graph::Graph(), te::graph::Graph::removeEdge(), te::graph::Graph::removeVertex(), and te::graph::Graph::~Graph().
|
inherited |
This class has the graph data and properties.
Definition at line 298 of file Graph.h.
Referenced by te::graph::Graph::add(), te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), add(), te::graph::Graph::flush(), te::graph::Graph::getEdge(), te::graph::Graph::getVertex(), te::graph::Graph::Graph(), te::graph::MemoryIterator::MemoryIterator(), te::graph::Graph::removeEdge(), te::graph::Graph::removeVertex(), and te::graph::Graph::update().
|
protectedinherited |
Graph Data loader strategy.
Definition at line 294 of file Graph.h.
Referenced by te::graph::Graph::add(), te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), add(), te::graph::Graph::addEdgeProperty(), te::graph::Graph::addVertexProperty(), te::graph::Graph::flush(), te::graph::Graph::getEdge(), te::graph::Graph::getEdgeProperty(), te::graph::Graph::getEdgePropertySize(), te::graph::Graph::getMetadata(), te::graph::Graph::getVertex(), te::graph::Graph::getVertexProperty(), te::graph::Graph::getVertexPropertySize(), te::graph::Graph::Graph(), te::graph::Graph::removeEdge(), te::graph::Graph::removeEdgeProperty(), te::graph::Graph::removeVertex(), and te::graph::Graph::removeVertexProperty().