Loading...
Searching...
No Matches
BidirectionalGraph.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file BidirectionalGraph.h
22
23 \brief This is a implementation of a Bidirectional Graph.
24 By convention a bidirectional graph provides access to
25 out-and in edges.
26*/
27
28#ifndef __TERRALIB_GRAPH_INTERNAL_BIDIRECTIONALGRAPH_H
29#define __TERRALIB_GRAPH_INTERNAL_BIDIRECTIONALGRAPH_H
30
31// Terralib Includes
32#include "../Config.h"
33#include "Graph.h"
34
35// STL Includes
36#include <vector>
37
38namespace te
39{
40 namespace graph
41 {
42 //forward declarations
45
46 /*!
47 \class BidirectionalGraph
48
49 \brief This is a implementation of a Bidirectional Graph.
50 By convention a bidirectional graph provides access to
51 out-and in edges.
52
53 \sa AbstractGraph, GraphData, GraphCache
54 */
55
57 {
58 public:
59
60 /*! \brief constructor. */
62
63 /*!
64 \brief Constructor
65
66 \param metadata A pointer to a graph metadata implementation
67
68 */
70
71 /*!
72 \brief Constructor
73
74 \param cp A pointer to a cache policy implementation
75
76 \param ls A pointer to a loader strategy implementation
77
78 */
80
81 /*! \brief Virtual destructor. */
83
84 /** @name Vertex Access Methods
85 * Method used to access vertex elements from a graph.
86 */
87 //@{
88
89 /*!
90 \brief The neighborhood of a vertex v is an induced subgraph of the graph, formed by all vertices adjacent to v.
91
92 \param id The attribute used to identify the vertex element
93
94 \return A vector with vertex elements.
95 */
96 virtual std::vector<te::graph::Vertex*> getVertexNeighborhood(int id);
97
98 /*!
99 \brief This function indicates if a desired element is a isolated vertex.
100
101 \param id The attribute used to identify the vertex element
102
103 \param flag Flag used to indicating if the element is a isolated vertex.
104
105 \return True if the vertex element was found and false in other case
106 */
107 virtual bool isIsolateVertex(int id, bool& flag);
108
109 /*!
110 \brief This function indicates if a desired element is a source vertex.
111
112 \param id The attribute used to identify the vertex element
113
114 \param flag Flag used to indicating if the element is a source vertex.
115
116 \return True if the vertex element was found and false in other case
117 */
118 virtual bool isSourceVertex(int id, bool& flag);
119
120 /*!
121 \brief This function indicates if a desired element is a sink vertex.
122
123 \param id The attribute used to identify the vertex element
124
125 \param flag Flag used to indicating if the element is a sink vertex.
126
127 \return True if the vertex element was found and false in other case
128 */
129 virtual bool isSinkVertex(int id, bool& flag);
130
131 //@}
132
133 /** @name Edge Access Methods
134 * Method used to access edge elements from a graph.
135 */
136 //@{
137
138 /*!
139 \brief Add a new edge element to a graph
140
141 \param e Edge element
142
143 \note This function turns the dirty flag of current GraphData to true, the
144 new flag of the edge turns to true.
145
146 */
147 virtual void add(Edge* e);
148
149 /*!
150 \brief This function removes the edge element from graph, also was removed
151 in data source.
152
153 \param id Edge identification
154
155 */
156 virtual void removeEdge(int id);
157
158 /*!
159 \brief It returns all edges that came in a vertex
160
161 \param vId The attribute used to identify the vertex element
162
163 \return A vector with edge elements.
164 */
165 virtual std::vector<te::graph::Edge*> getInEdges(int vId);
166
167 /*!
168 \brief It returns all edges that came out a vertex
169
170 \param vId The attribute used to identify the vertex element
171
172 \return A vector with edge elements.
173 */
174 virtual std::vector<te::graph::Edge*> getOutEdges(int vId);
175
176 //@}
177
178 };
179
180 } // end namespace graph
181} // end namespace te
182
183#endif // __TERRALIB_GRAPH_INTERNAL_BIDIRECTIONALGRAPH_H
This is the main graph implementation, that uses a cache policy anda graph loader to get all elements...
This class is used to set the main functions of a cache policy.
This class define the main functions necessary to save and load the graph data and metadata informati...
virtual void removeEdge(int id)
This function removes the edge element from graph, also was removed in data source.
virtual std::vector< te::graph::Edge * > getOutEdges(int vId)
It returns all edges that came out a vertex.
~BidirectionalGraph()
Virtual destructor.
virtual bool isSinkVertex(int id, bool &flag)
This function indicates if a desired element is a sink vertex.
BidirectionalGraph(GraphMetadata *metadata)
Constructor.
virtual std::vector< te::graph::Edge * > getInEdges(int vId)
It returns all edges that came in a vertex.
virtual void add(Edge *e)
Add a new edge element to 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 t...
virtual bool isSourceVertex(int id, bool &flag)
This function indicates if a desired element is a source vertex.
virtual bool isIsolateVertex(int id, bool &flag)
This function indicates if a desired element is a isolated vertex.
BidirectionalGraph(AbstractCachePolicy *cp, AbstractGraphLoaderStrategy *ls)
Constructor.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition Edge.h:59
Class used to define the graph metadata informations.
Graph()
constructor.
TerraLib.
Configuration flags for the Graph module of TerraLib.
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:178