UndirectedGraph.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 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 metadata A pointer to a graph metadata implementation
67 
68  */
69  UndirectedGraph(GraphMetadata* metadata);
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. */
82  ~UndirectedGraph();
83 
84 
85  /** @name Vertex Access Methods
86  * Method used to access vertex elements from a graph.
87  */
88  //@{
89 
90 
91  /*!
92  \brief The neighborhood of a vertex v is an induced subgraph of the graph, formed by all vertices adjacent to v.
93 
94  \param id The attribute used to identify the vertex element
95 
96  \return A vector with vertex elements.
97  */
98  virtual std::vector<te::graph::Vertex*> getVertexNeighborhood(int id);
99 
100  /*!
101  \brief This function indicates if a desired element is a isolated vertex.
102 
103  \param id The attribute used to identify the vertex element
104 
105  \param flag Flag used to indicating if the element is a isolated vertex.
106 
107  \return True if the vertex element was found and false in other case
108  */
109  virtual bool isIsolateVertex(int id, bool& flag);
110 
111  //@}
112 
113  /** @name Edge Access Methods
114  * Method used to access edge elements from a graph.
115  */
116  //@{
117 
118  /*!
119  \brief Add a new edge element to a graph
120 
121  \param e Edge element
122 
123  \note This function turns the dirty flag of current GraphData to true, the
124  new flag of the edge turns to true.
125 
126  */
127  virtual void add(Edge* e);
128 
129 
130  /*!
131  \brief This function removes the edge element from graph, also was removed
132  in data source.
133 
134  \param id Edge identification
135 
136  */
137  virtual void removeEdge(int id);
138 
139  /*!
140  \brief It returns all edges that belongs to a vertex
141 
142  \param vId The attribute used to identify the vertex element
143 
144  \return A vector with edge elements.
145  */
146  virtual std::vector<te::graph::Edge*> getEdges(int vId);
147 
148  //@}
149 
150  };
151 
152  } // end namespace graph
153 } // end namespace te
154 
155 #endif // __TERRALIB_GRAPH_INTERNAL_UNDIRECTEDGRAPH_H
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:178
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:58
This class is used to set the main functions of a cache policy.
URI C++ Library.
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 a implementation of a UndirectedGraph Graph. By definition a undirected graph has no directio...
This is the main graph implementation, that uses a cache policy anda graph loader to get all elements...
Definition: Graph.h:72
Class used to define the graph metadata informations.
Definition: GraphMetadata.h:56