All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UndirectedGraph.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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 UndirectedGraph.h
22 
23  \brief This is a implementation of a UndirectedGraph Graph.
24  By definition a undirected graph has no direction
25  information about his edges.
26 */
27 
28 #ifndef __TERRALIB_GRAPH_INTERNAL_UNDIRECTEDGRAPH_H
29 #define __TERRALIB_GRAPH_INTERNAL_UNDIRECTEDGRAPH_H
30 
31 // Terralib Includes
32 #include "../Config.h"
33 #include "Graph.h"
34 
35 // STL Includes
36 #include <vector>
37 
38 namespace te
39 {
40  namespace graph
41  {
42  //forward declarations
43  class AbstractCachePolicy;
44  class AbstractGraphLoaderStrategy;
45 
46  /*!
47  \class UndirectedGraph
48 
49  \brief This is a implementation of a UndirectedGraph Graph.
50  By definition a undirected graph has no direction
51  information about his edges.
52 
53  \sa Graph, GraphData, GraphCache
54  */
55 
57  {
58  public:
59 
60  /*! \brief constructor. */
62 
63  /*!
64  \brief Constructor
65 
66  \param cp A pointer to a cache policy implementation
67 
68  \param ls A pointer to a loader strategy implementation
69 
70  */
72 
73  /*! \brief Virtual destructor. */
74  ~UndirectedGraph();
75 
76 
77  /** @name Vertex Access Methods
78  * Method used to access vertex elements from a graph.
79  */
80  //@{
81 
82 
83  /*!
84  \brief The neighborhood of a vertex v is an induced subgraph of the graph, formed by all vertices adjacent to v.
85 
86  \param id The attribute used to identify the vertex element
87 
88  \return A vector with vertex elements.
89  */
90  virtual std::vector<te::graph::Vertex*> getVertexNeighborhood(int id);
91 
92  /*!
93  \brief This function indicates if a desired element is a isolated vertex.
94 
95  \param id The attribute used to identify the vertex element
96 
97  \param flag Flag used to indicating if the element is a isolated vertex.
98 
99  \return True if the vertex element was found and false in other case
100  */
101  virtual bool isIsolateVertex(int id, bool& flag);
102 
103  //@}
104 
105  /** @name Edge Access Methods
106  * Method used to access edge elements from a graph.
107  */
108  //@{
109 
110  /*!
111  \brief Add a new edge element to a graph
112 
113  \param e Edge element
114 
115  \note This function turns the dirty flag of current GraphData to true, the
116  new flag of the edge turns to true.
117 
118  */
119  virtual void add(Edge* e);
120 
121 
122  /*!
123  \brief This function removes the edge element from graph, also was removed
124  in data source.
125 
126  \param id Edge identification
127 
128  */
129  virtual void removeEdge(int id);
130 
131  /*!
132  \brief It returns all edges that belongs to a vertex
133 
134  \param vId The attribute used to identify the vertex element
135 
136  \return A vector with edge elements.
137  */
138  virtual std::vector<te::graph::Edge*> getEdges(int vId);
139 
140  //@}
141 
142  };
143 
144  } // end namespace graph
145 } // end namespace te
146 
147 #endif // __TERRALIB_GRAPH_INTERNAL_UNDIRECTEDGRAPH_H
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:58
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:216
This class define the main functions necessary to save and load the graph data and metadata informati...
This is the main graph implementation, that uses a cache policy anda graph loader to get all elements...
This is the main graph implementation, that uses a cache policy anda graph loader to get all elements...
Definition: Graph.h:72
This is a implementation of a UndirectedGraph Graph. By definition a undirected graph has no directio...
This class is used to set the main functions of a cache policy.