This file is indexed.

/usr/include/gamera/graph/graph.hpp is in python-gamera-dev 3.3.3-2+deb7u1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
 *
 * Copyright (C) 2011 Christian Brandt
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef _GRAPH_HPP_97CAD8A8D00E4D
#define _GRAPH_HPP_97CAD8A8D00E4D

#include "graph_common.hpp"
#include "bfsdfsiterator.hpp"
#include "edgenodeiterator.hpp"
#include "edge.hpp"

namespace Gamera { namespace GraphApi {

   
   
// Colorization
typedef std::vector<unsigned int> Histogram;
typedef std::map<Node*, int> ColorMap;



struct Graph { 
   NodeVector _nodes;      ///< list of nodes in this graph
   EdgeVector _edges;      ///< list of edges in this graph
   ValueNodeMap _valuemap; ///< STL-Map value->node for this graph
   flag_t _flags;

   ColorMap* _colors;
   Histogram* _colorhistogram;


   // --------------------------------------------------------------------------
   // Structure
   // --------------------------------------------------------------------------
   Graph(bool directed , bool check_on_insert=false);
   Graph(flag_t flags = FLAG_FREE);
   ~Graph();
   Graph(Graph &g);
   Graph(Graph *g, flag_t flags = FLAG_FREE);



   // --------------------------------------------------------------------------
   // methods for nodesnodes
   // --------------------------------------------------------------------------
   bool add_node(GraphData * value);
   bool add_node(Node* node);

   /// add node variant returns ptr to added node or existing node
   Node* add_node_ptr(GraphData * value);
   int add_nodes(NodeVector nodes);
   int add_nodes(ValueVector values);

   Node* get_node(GraphData * value);
   NodePtrIterator* get_nodes();
   bool has_node(Node* node);
   bool has_node(GraphData * value);

   void remove_node(Node* node);
   void remove_node(GraphData * value);
   void remove_node_and_edges(Node* node);
   void remove_node_and_edges(GraphData * value);

   // --------------------------------------------------------------------------
   // methods for edges
   // --------------------------------------------------------------------------
   int add_edge(GraphData * from_value, GraphData * to_value, 
         cost_t cost = 1.0, bool directed = false, 
         void* label = NULL);
   int add_edge(Node* from_node, Node* to_node, cost_t cost = 1.0, 
         bool directed = false, void* label = NULL);

   EdgePtrIterator* get_edges();
   bool has_edge(GraphData * from_value, GraphData * to_value);
   bool has_edge(Node* from_node, Node* to_node);

   bool has_edge(Edge* edge) { 
      return has_edge(edge->from_node, edge->to_node); 
   }

   void remove_edge(GraphData * from_value, GraphData * to_value);
   void remove_edge(Node* from_node, Node* to_node);
   void remove_edge(Edge* edge);
   void remove_all_edges();
 
   // --------------------------------------------------------------------------
   // size of graph
   // --------------------------------------------------------------------------
   size_t get_nnodes() { return _nodes.size(); }
   size_t get_nedges() { return _edges.size(); }


   // --------------------------------------------------------------------------
   // flags and restrictions
   // --------------------------------------------------------------------------
   bool conforms_restrictions();
   bool has_flag(flag_t flag) {
      return GRAPH_HAS_FLAG(this, flag);
   }

   bool is_directed();
   bool is_undirected() { return !is_directed();}
   void make_directed();
   void make_undirected();

   bool is_cyclic();
   bool is_acyclic() { return !is_cyclic(); }
   void make_cyclic();
   void make_acyclic();

   void make_tree();
   void make_blob();
   bool is_tree();
   bool is_blob() { return !is_tree(); }

   bool is_multi_connected();
   bool is_singly_connected() { return !is_multi_connected(); }
   void make_multi_connected();
   void make_singly_connected();

   bool is_self_connected();
   bool is_not_self_connected() { return !is_self_connected(); }
   void make_self_connected();
   void make_not_self_connected();

   
   
   // --------------------------------------------------------------------------
   // subgraphs
   // --------------------------------------------------------------------------
   NodeVector *get_subgraph_roots();
   size_t size_of_subgraph(GraphData * value);
   size_t size_of_subgraph(Node* node);
   size_t get_nsubgraphs();
   bool is_fully_connected();


   
   // --------------------------------------------------------------------------
   // algorithms
   // --------------------------------------------------------------------------
   BfsIterator* BFS(Node* node);
   BfsIterator* BFS(GraphData * value);
   DfsIterator* DFS(Node* node);
   DfsIterator* DFS(GraphData * value);

   ShortestPathMap* dijkstra_shortest_path(Node* node);
   ShortestPathMap* dijkstra_shortest_path(GraphData * value);
   ShortestPathMap* shortest_path(Node* node) { 
      return dijkstra_shortest_path(node); 
   }
   ShortestPathMap* shortest_path(GraphData * value) { 
      return dijkstra_shortest_path(value); 
   }

   std::map<Node*, ShortestPathMap*> dijkstra_all_pairs_shortest_path();

   /// currently same as dijkstra_all_pairs_shortest_path
   std::map<Node*, ShortestPathMap*> all_pairs_shortest_path();

   bool has_path(Node* from_node, Node* to_node);
   bool has_path(GraphData * from_value, GraphData * to_value);

   Graph *create_spanning_tree(Node* node);
   Graph *create_spanning_tree(GraphData * value);
   Graph *create_minimum_spanning_tree(); //kruskal

   //optimize_partitions only implemented in Python-wrapper


   // --------------------------------------------------------------------------
   // colorization
   // --------------------------------------------------------------------------
   unsigned int get_color(Node* n);
   unsigned int get_color(GraphData * value) {
      Node* n = get_node(value);
      return get_color(n);
   }
   void set_color(Node* n, unsigned int color);
   void colorize(unsigned int ncolors = 6);
};



}} // end Gamera::GraphApi

#endif /* _GRAPH_HPP_97CAD8A8D00E4D */