All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DirectedGraph.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 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 cp A pointer to a cache policy implementation
65 
66  \param ls A pointer to a loader strategy implementation
67 
68  */
70 
71  /*! \brief Virtual destructor. */
72  ~DirectedGraph();
73 
74 
75  /** @name Vertex Access Methods
76  * Method used to access vertex elements from a graph.
77  */
78  //@{
79 
80  /*!
81  \brief The neighborhood of a vertex v is an induced subgraph of the graph, formed by all vertices adjacent to v.
82 
83  \param id The attribute used to identify the vertex element
84 
85  \return A vector with vertex elements.
86  */
87  virtual std::vector<te::graph::Vertex*> getVertexNeighborhood(int id);
88 
89  /*!
90  \brief This function indicates if a desired element is a sink vertex.
91 
92  \param id The attribute used to identify the vertex element
93 
94  \param flag Flag used to indicating if the element is a sink vertex.
95 
96  \return True if the vertex element was found and false in other case
97  */
98  virtual bool isSinkVertex(int id, bool& flag);
99 
100  //@}
101 
102  /** @name Edge Access Methods
103  * Method used to access edge elements from a graph.
104  */
105  //@{
106 
107  /*!
108  \brief Add a new edge element to a graph
109 
110  \param e Edge element
111 
112  \note This function turns the dirty flag of current GraphData to true, the
113  new flag of the edge turns to true.
114 
115  */
116  virtual void add(Edge* e);
117 
118  /*!
119  \brief This function removes the edge element from graph, also was removed
120  in data source.
121 
122  \param id Edge identification
123 
124  */
125  virtual void removeEdge(int id);
126 
127  /*!
128  \brief It returns all edges that came out a vertex
129 
130  \param vId The attribute used to identify the vertex element
131 
132  \return A vector with edge elements.
133  */
134  virtual std::vector<te::graph::Edge*> getOutEdges(int vId);
135 
136  //@}
137  };
138 
139  } // end namespace graph
140 } // end namespace te
141 
142 #endif // __TERRALIB_GRAPH_INTERNAL_DIRECTEDGRAPH_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 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
This class is used to set the main functions of a cache policy.