This is the main graph implementation, that uses a cache policy anda graph loader to get all elements inside a data source. More...
#include <Graph.h>
Public Member Functions | |
| 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... | |
| Graph () | |
| constructor. More... | |
| Graph (GraphMetadata *metadata) | |
| Constructor. More... | |
| Graph (AbstractCachePolicy *cp, AbstractGraphLoaderStrategy *ls) | |
| Constructor. More... | |
| ~Graph () | |
| Virtual destructor. 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 | add (Edge *e) |
| Add a new edge element to a graph. More... | |
| virtual void | update (Edge *e) |
| Update the edge element. More... | |
| virtual void | removeEdge (int id) |
| This function removes the edge element from graph, also was removed in data source. 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 the main graph implementation, that uses a cache policy anda graph loader to get all elements inside a data source.
All methods to access a graph element (vertex or edge) will use the GraphData instance, if not found the element, the class GraphCache will be consulted.
| te::graph::Graph::Graph | ( | GraphMetadata * | metadata | ) |
Constructor.
| metadata | A pointer to a graph metadata implementation |
Definition at line 60 of file Graph.cpp.
References m_graphData, te::graph::GraphMetadata::m_memoryGraph, and m_metadata.
| te::graph::Graph::Graph | ( | AbstractCachePolicy * | cp, |
| AbstractGraphLoaderStrategy * | ls | ||
| ) |
Constructor.
| cp | A pointer to a cache policy implementation |
| ls | A pointer to a loader strategy implementation |
Definition at line 73 of file Graph.cpp.
References te::graph::AbstractGraphLoaderStrategy::getMetadata(), m_dataManager, m_graphCache, m_metadata, and te::graph::GraphDataManager::setLoaderStrategy().
| te::graph::Graph::~Graph | ( | ) |
Virtual destructor.
Definition at line 93 of file Graph.cpp.
References flush(), m_dataManager, and m_graphCache.
|
virtual |
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(), m_graphCache, m_graphData, te::graph::GraphMetadata::m_maxCacheSize, te::graph::GraphMetadata::m_memoryGraph, and m_metadata.
Referenced by te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), and te::graph::BidirectionalGraph::add().
|
virtual |
Add a new edge element to a graph.
| e | Edge element |
Implements te::graph::AbstractGraph.
Reimplemented in te::graph::BidirectionalGraph, te::graph::UndirectedGraph, and te::graph::DirectedGraph.
Definition at line 197 of file Graph.cpp.
References te::graph::GraphData::addEdge(), te::graph::GraphData::getEdgeMap(), te::graph::GraphCache::getGraphData(), m_graphCache, m_graphData, te::graph::GraphMetadata::m_maxCacheSize, te::graph::GraphMetadata::m_memoryGraph, and m_metadata.
|
virtual |
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 m_metadata.
|
virtual |
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 m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
|
virtual |
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(), m_graphCache, m_graphData, te::graph::GraphMetadata::m_memoryGraph, and m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute(), and ~Graph().
|
virtual |
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(), m_graphCache, m_graphData, te::graph::GraphMetadata::m_memoryGraph, and m_metadata.
Referenced by te::graph::AddDeepAttribute::calculateDeepValue(), te::graph::UndirectedGraph::getEdges(), te::graph::BidirectionalGraph::getInEdges(), te::graph::DirectedGraph::getOutEdges(), te::graph::BidirectionalGraph::getOutEdges(), te::graph::GetSubGraph::getPredecessor(), te::graph::GetSubGraph::GetSubGraph(), te::graph::DirectedGraph::getVertexNeighborhood(), te::graph::BidirectionalGraph::getVertexNeighborhood(), te::graph::UndirectedGraph::getVertexNeighborhood(), te::graph::DirectedGraph::removeEdge(), te::graph::UndirectedGraph::removeEdge(), and te::graph::BidirectionalGraph::removeEdge().
|
virtual |
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 m_metadata.
|
virtual |
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 m_metadata.
|
virtual |
Function used to access the graph metadata.
Implements te::graph::AbstractGraph.
Definition at line 293 of file Graph.cpp.
References m_metadata.
|
virtual |
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(), m_graphCache, m_graphData, te::graph::GraphMetadata::m_memoryGraph, and m_metadata.
Referenced by te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), te::graph::BidirectionalGraph::add(), te::graph::AddDeepAttribute::calculateDeepValue(), te::graph::UndirectedGraph::getEdges(), te::graph::BidirectionalGraph::getInEdges(), te::graph::DirectedGraph::getOutEdges(), te::graph::BidirectionalGraph::getOutEdges(), te::graph::GetSubGraph::getPredecessor(), te::graph::GetSubGraph::GetSubGraph(), te::graph::DirectedGraph::getVertexNeighborhood(), te::graph::BidirectionalGraph::getVertexNeighborhood(), te::graph::UndirectedGraph::getVertexNeighborhood(), te::graph::BidirectionalGraph::isIsolateVertex(), te::graph::UndirectedGraph::isIsolateVertex(), te::graph::DirectedGraph::isSinkVertex(), te::graph::BidirectionalGraph::isSinkVertex(), te::graph::BidirectionalGraph::isSourceVertex(), te::graph::DirectedGraph::removeEdge(), te::graph::UndirectedGraph::removeEdge(), and te::graph::BidirectionalGraph::removeEdge().
|
virtual |
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 m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
|
virtual |
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 m_metadata.
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
|
virtual |
This function removes the edge element from graph, also was removed in data source.
| id | Edge identification |
Implements te::graph::AbstractGraph.
Reimplemented in te::graph::BidirectionalGraph, te::graph::UndirectedGraph, and te::graph::DirectedGraph.
Definition at line 219 of file Graph.cpp.
References te::graph::GraphCache::getGraphDataByEdgeId(), m_dataManager, m_graphCache, m_graphData, te::graph::GraphMetadata::m_memoryGraph, m_metadata, te::graph::GraphData::removeEdge(), and te::graph::GraphDataManager::removeEdge().
Referenced by te::graph::DirectedGraph::removeEdge(), te::graph::UndirectedGraph::removeEdge(), and te::graph::BidirectionalGraph::removeEdge().
|
virtual |
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 m_metadata, and te::graph::GraphMetadata::removeEdgeProperty().
|
virtual |
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(), m_dataManager, m_graphCache, m_graphData, te::graph::GraphMetadata::m_memoryGraph, m_metadata, te::graph::GraphData::removeVertex(), and te::graph::GraphDataManager::removeVertex().
|
virtual |
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 m_metadata, and te::graph::GraphMetadata::removeVertexProperty().
|
virtual |
Update the vertex element.
| v | Vertex element |
Implements te::graph::AbstractGraph.
Definition at line 116 of file Graph.cpp.
References m_graphData, te::graph::GraphData::setDirty(), and te::graph::Vertex::setDirty().
Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().
|
virtual |
Update the edge element.
| e | Edge element |
Implements te::graph::AbstractGraph.
Definition at line 212 of file Graph.cpp.
References m_graphData, te::graph::GraphData::setDirty(), and te::graph::Edge::setDirty().
|
protected |
Used to load and save GraphData information from a DataSource.
Definition at line 290 of file Graph.h.
Referenced by Graph(), removeEdge(), removeVertex(), and ~Graph().
|
protected |
Class used to keep all graph data loaded.
Definition at line 292 of file Graph.h.
Referenced by add(), te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), te::graph::BidirectionalGraph::add(), flush(), getEdge(), getVertex(), Graph(), removeEdge(), removeVertex(), and ~Graph().
| GraphData* te::graph::Graph::m_graphData |
This class has the graph data and properties.
Definition at line 298 of file Graph.h.
Referenced by add(), te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), te::graph::BidirectionalGraph::add(), flush(), getEdge(), getVertex(), Graph(), te::graph::MemoryIterator::MemoryIterator(), removeEdge(), removeVertex(), and update().
|
protected |
Graph Data loader strategy.
Definition at line 294 of file Graph.h.
Referenced by add(), te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), te::graph::BidirectionalGraph::add(), addEdgeProperty(), addVertexProperty(), flush(), getEdge(), getEdgeProperty(), getEdgePropertySize(), getMetadata(), getVertex(), getVertexProperty(), getVertexPropertySize(), Graph(), removeEdge(), removeEdgeProperty(), removeVertex(), and removeVertexProperty().