This file is indexed.

/usr/include/polymake/graph/SpringEmbedder.h is in libpolymake-dev-common 3.2r2-3.

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
/* Copyright (c) 1997-2018
   Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
   http://www.polymake.org

   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, or (at your option) any
   later version: http://www.gnu.org/licenses/gpl.txt.

   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.
--------------------------------------------------------------------------------
*/

#ifndef POLYMAKE_GRAPH_SPRING_EMBEDDER_H
#define POLYMAKE_GRAPH_SPRING_EMBEDDER_H

#include "polymake/client.h"
#include "polymake/Matrix.h"
#include "polymake/Vector.h"
#include "polymake/Graph.h"
#include "polymake/Set.h"
#include "polymake/RandomSpherePoints.h"
#include "polymake/vector"
#include <cmath>

namespace polymake { namespace graph {

class SpringEmbedder {
protected:
   const Graph<>& G;

   bool gravity;
   double viscosity, inertion, epsilon, epsilon_2;
   double scale, eff_scale, rep, z_factor;
   double min_edge_weight, avg_edge_weight;
   Vector<double> z_ordering;
   double z_min, z_max;
   Set<int> fixed_vertices;

   Matrix<double> V;            // current velocity
   Vector<double> barycenter;
   std::vector<double> wanted_edge_length, inv_wanted_length;

#if POLYMAKE_DEBUG
   bool debug_print;
#endif
   void init_params(const perl::OptionSet& options);
   void calculate_forces(const Matrix<double>& X, RandomSpherePoints<double>& random_points, Matrix<double>& F);

public:
   SpringEmbedder(const Graph<>& G_arg, const perl::OptionSet& options)
      : G(G_arg)
   {
      init_params(options);
   }

   const Graph<>& get_graph() const { return G; }

   double set_viscosity(double x) { double old=viscosity; viscosity=x; return old; }
   double set_inertion(double x) { double old=inertion; inertion=x; return old; }
   void set_eps(double eps) { epsilon=eps; epsilon_2 = eps*eps; }

   double get_viscosity() const { return viscosity; }
   double get_inertion() const { return inertion; }

   double set_repulsion(double r) { double old=rep; rep=r; return old; }
   double set_z_factor(double f) { double old=z_factor; z_factor=f; return old; }

   const Set<int> set_fixed_vertices(const Set<int>& v) { Set<int> old=fixed_vertices; fixed_vertices=v; return old; }

   const double get_repulsion() { return rep; }
   const double get_z_factor() { return z_factor; }
   const bool has_z_ordering() { return !z_ordering.empty(); }

   template <typename Iterator>
   void start_points(Matrix<double>& X, Iterator src)
   {
      V.resize(X.rows(),X.cols());

      for (Entire< Rows< Matrix<double> > >::iterator x=entire(rows(X));  !x.at_end();  ++x, ++src)
         *x=*src * eff_scale;
      V.fill(0.);

      if (has_z_ordering()) {
         z_min=-eff_scale;
         z_max=eff_scale;
      }
      gravity=fixed_vertices.empty();
      barycenter.resize(X.cols());
   }

   void restart(const Matrix<double>& X);

   bool calculate(Matrix<double>& X, RandomSpherePoints<double>& random_points, int max_iterations);

#if POLYMAKE_DEBUG
   bool debug_print_enabled() const { return debug_print; }
#endif
};

} }

#endif // POLYMAKE_GRAPH_SPRING_EMBEDDER_H

// Local Variables:
// mode:C++
// c-basic-offset:3
// indent-tabs-mode:nil
// End: