DirectedGraph.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 DirectedGraph.h
22 
23  \brief This is a implementation of a Directed Graph.
24  By convention a directed graph provides access to out-edges only.
25 */
26 
27 #ifndef __TERRALIB_GRAPH_INTERNAL_DIRECTEDGRAPH_H
28 #define __TERRALIB_GRAPH_INTERNAL_DIRECTEDGRAPH_H
29 
30 // Terralib Includes
31 #include "../Config.h"
32 #include "Graph.h"
33 
34 // STL Includes
35 #include <vector>
36 
37 namespace te
38 {
39  namespace graph
40  {
41  //forward declarations
42  class AbstractCachePolicy;
43  class AbstractGraphLoaderStrategy;
44 
45  /*!
46  \class DirectedGraph
47 
48  \brief This is a implementation of a Directed Graph.
49  By convention a directed graph provides access to out-edges only.
50 
51  \sa Graph, GraphData, GraphCache
52  */
53 
55  {
56  public:
57 
58  /*! \brief constructor. */
59  DirectedGraph();
60 
61  /*!
62  \brief Constructor
63 
64  \param metadata A pointer to a graph metadata implementation
65 
66  */
67  DirectedGraph(GraphMetadata* metadata);
68 
69  /*!
70  \brief Constructor
71 
72  \param cp A pointer to a cache policy implementation
73 
74  \param ls A pointer to a loader strategy implementation
75 
76  */
78 
79  /*! \brief Virtual destructor. */
80  ~DirectedGraph();
81 
82 
83  /** @name Vertex Access Methods
84  * Method used to access vertex elements from a graph.
85  */
86  //@{
87 
88  /*!
89  \brief The neighborhood of a vertex v is an induced subgraph of the graph, formed by all vertices adjacent to v.
90 
91  \param id The attribute used to identify the vertex element
92 
93  \return A vector with vertex elements.
94  */
95  virtual std::vector<te::graph::Vertex*> getVertexNeighborhood(int id);
96 
97  /*!
98  \brief This function indicates if a desired element is a sink vertex.
99 
100  \param id The attribute used to identify the vertex element
101 
102  \param flag Flag used to indicating if the element is a sink vertex.
103 
104  \return True if the vertex element was found and false in other case
105  */
106  virtual bool isSinkVertex(int id, bool& flag);
107 
108  //@}
109 
110  /** @name Edge Access Methods
111  * Method used to access edge elements from a graph.
112  */
113  //@{
114 
115  /*!
116  \brief Add a new edge element to a graph
117 
118  \param e Edge element
119 
120  \note This function turns the dirty flag of current GraphData to true, the
121  new flag of the edge turns to true.
122 
123  */
124  virtual void add(Edge* e);
125 
126  /*!
127  \brief This function removes the edge element from graph, also was removed
128  in data source.
129 
130  \param id Edge identification
131 
132  */
133  virtual void removeEdge(int id);
134 
135  /*!
136  \brief It returns all edges that came out a vertex
137 
138  \param vId The attribute used to identify the vertex element
139 
140  \return A vector with edge elements.
141  */
142  virtual std::vector<te::graph::Edge*> getOutEdges(int vId);
143 
144  //@}
145  };
146 
147  } // end namespace graph
148 } // end namespace te
149 
150 #endif // __TERRALIB_GRAPH_INTERNAL_DIRECTEDGRAPH_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 Directed Graph. By convention a directed graph provides access to out-e...
Definition: DirectedGraph.h:54
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