lemongraph 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +8 -0
  3. data/LICENSE +674 -0
  4. data/README.md +6 -0
  5. data/ext/lemon-1.3.1/AUTHORS +26 -0
  6. data/ext/lemon-1.3.1/CMakeLists.txt +371 -0
  7. data/ext/lemon-1.3.1/INSTALL +167 -0
  8. data/ext/lemon-1.3.1/LICENSE +32 -0
  9. data/ext/lemon-1.3.1/NEWS +337 -0
  10. data/ext/lemon-1.3.1/README +50 -0
  11. data/ext/lemon-1.3.1/cmake/FindCOIN.cmake +110 -0
  12. data/ext/lemon-1.3.1/cmake/FindGLPK.cmake +55 -0
  13. data/ext/lemon-1.3.1/cmake/FindGhostscript.cmake +10 -0
  14. data/ext/lemon-1.3.1/cmake/FindILOG.cmake +102 -0
  15. data/ext/lemon-1.3.1/cmake/FindSOPLEX.cmake +23 -0
  16. data/ext/lemon-1.3.1/cmake/LEMONConfig.cmake.in +13 -0
  17. data/ext/lemon-1.3.1/cmake/nsis/lemon.ico +0 -0
  18. data/ext/lemon-1.3.1/cmake/nsis/uninstall.ico +0 -0
  19. data/ext/lemon-1.3.1/cmake/version.cmake +1 -0
  20. data/ext/lemon-1.3.1/cmake/version.cmake.in +1 -0
  21. data/ext/lemon-1.3.1/contrib/CMakeLists.txt +19 -0
  22. data/ext/lemon-1.3.1/lemon/CMakeLists.txt +91 -0
  23. data/ext/lemon-1.3.1/lemon/adaptors.h +3638 -0
  24. data/ext/lemon-1.3.1/lemon/arg_parser.cc +474 -0
  25. data/ext/lemon-1.3.1/lemon/arg_parser.h +440 -0
  26. data/ext/lemon-1.3.1/lemon/assert.h +214 -0
  27. data/ext/lemon-1.3.1/lemon/base.cc +37 -0
  28. data/ext/lemon-1.3.1/lemon/bellman_ford.h +1116 -0
  29. data/ext/lemon-1.3.1/lemon/bfs.h +1754 -0
  30. data/ext/lemon-1.3.1/lemon/bin_heap.h +347 -0
  31. data/ext/lemon-1.3.1/lemon/binomial_heap.h +445 -0
  32. data/ext/lemon-1.3.1/lemon/bits/alteration_notifier.h +472 -0
  33. data/ext/lemon-1.3.1/lemon/bits/array_map.h +351 -0
  34. data/ext/lemon-1.3.1/lemon/bits/bezier.h +174 -0
  35. data/ext/lemon-1.3.1/lemon/bits/default_map.h +182 -0
  36. data/ext/lemon-1.3.1/lemon/bits/edge_set_extender.h +627 -0
  37. data/ext/lemon-1.3.1/lemon/bits/enable_if.h +131 -0
  38. data/ext/lemon-1.3.1/lemon/bits/graph_adaptor_extender.h +401 -0
  39. data/ext/lemon-1.3.1/lemon/bits/graph_extender.h +1332 -0
  40. data/ext/lemon-1.3.1/lemon/bits/lock.h +65 -0
  41. data/ext/lemon-1.3.1/lemon/bits/map_extender.h +332 -0
  42. data/ext/lemon-1.3.1/lemon/bits/path_dump.h +177 -0
  43. data/ext/lemon-1.3.1/lemon/bits/solver_bits.h +194 -0
  44. data/ext/lemon-1.3.1/lemon/bits/traits.h +388 -0
  45. data/ext/lemon-1.3.1/lemon/bits/variant.h +494 -0
  46. data/ext/lemon-1.3.1/lemon/bits/vector_map.h +244 -0
  47. data/ext/lemon-1.3.1/lemon/bits/windows.cc +166 -0
  48. data/ext/lemon-1.3.1/lemon/bits/windows.h +44 -0
  49. data/ext/lemon-1.3.1/lemon/bucket_heap.h +594 -0
  50. data/ext/lemon-1.3.1/lemon/capacity_scaling.h +1014 -0
  51. data/ext/lemon-1.3.1/lemon/cbc.cc +460 -0
  52. data/ext/lemon-1.3.1/lemon/cbc.h +129 -0
  53. data/ext/lemon-1.3.1/lemon/christofides_tsp.h +254 -0
  54. data/ext/lemon-1.3.1/lemon/circulation.h +807 -0
  55. data/ext/lemon-1.3.1/lemon/clp.cc +464 -0
  56. data/ext/lemon-1.3.1/lemon/clp.h +164 -0
  57. data/ext/lemon-1.3.1/lemon/color.cc +44 -0
  58. data/ext/lemon-1.3.1/lemon/color.h +204 -0
  59. data/ext/lemon-1.3.1/lemon/concept_check.h +77 -0
  60. data/ext/lemon-1.3.1/lemon/concepts/bpgraph.h +1029 -0
  61. data/ext/lemon-1.3.1/lemon/concepts/digraph.h +491 -0
  62. data/ext/lemon-1.3.1/lemon/concepts/graph.h +788 -0
  63. data/ext/lemon-1.3.1/lemon/concepts/graph_components.h +2134 -0
  64. data/ext/lemon-1.3.1/lemon/concepts/heap.h +324 -0
  65. data/ext/lemon-1.3.1/lemon/concepts/maps.h +223 -0
  66. data/ext/lemon-1.3.1/lemon/concepts/path.h +312 -0
  67. data/ext/lemon-1.3.1/lemon/config.h.in +22 -0
  68. data/ext/lemon-1.3.1/lemon/connectivity.h +1688 -0
  69. data/ext/lemon-1.3.1/lemon/core.h +2506 -0
  70. data/ext/lemon-1.3.1/lemon/cost_scaling.h +1607 -0
  71. data/ext/lemon-1.3.1/lemon/counter.h +249 -0
  72. data/ext/lemon-1.3.1/lemon/cplex.cc +994 -0
  73. data/ext/lemon-1.3.1/lemon/cplex.h +292 -0
  74. data/ext/lemon-1.3.1/lemon/cycle_canceling.h +1230 -0
  75. data/ext/lemon-1.3.1/lemon/dfs.h +1637 -0
  76. data/ext/lemon-1.3.1/lemon/dheap.h +352 -0
  77. data/ext/lemon-1.3.1/lemon/dijkstra.h +1303 -0
  78. data/ext/lemon-1.3.1/lemon/dim2.h +726 -0
  79. data/ext/lemon-1.3.1/lemon/dimacs.h +448 -0
  80. data/ext/lemon-1.3.1/lemon/edge_set.h +1420 -0
  81. data/ext/lemon-1.3.1/lemon/edmonds_karp.h +556 -0
  82. data/ext/lemon-1.3.1/lemon/elevator.h +982 -0
  83. data/ext/lemon-1.3.1/lemon/error.h +276 -0
  84. data/ext/lemon-1.3.1/lemon/euler.h +287 -0
  85. data/ext/lemon-1.3.1/lemon/fib_heap.h +475 -0
  86. data/ext/lemon-1.3.1/lemon/fractional_matching.h +2139 -0
  87. data/ext/lemon-1.3.1/lemon/full_graph.h +1082 -0
  88. data/ext/lemon-1.3.1/lemon/glpk.cc +1012 -0
  89. data/ext/lemon-1.3.1/lemon/glpk.h +263 -0
  90. data/ext/lemon-1.3.1/lemon/gomory_hu.h +568 -0
  91. data/ext/lemon-1.3.1/lemon/graph_to_eps.h +1186 -0
  92. data/ext/lemon-1.3.1/lemon/greedy_tsp.h +251 -0
  93. data/ext/lemon-1.3.1/lemon/grid_graph.h +699 -0
  94. data/ext/lemon-1.3.1/lemon/grosso_locatelli_pullan_mc.h +840 -0
  95. data/ext/lemon-1.3.1/lemon/hao_orlin.h +1015 -0
  96. data/ext/lemon-1.3.1/lemon/hartmann_orlin_mmc.h +654 -0
  97. data/ext/lemon-1.3.1/lemon/howard_mmc.h +651 -0
  98. data/ext/lemon-1.3.1/lemon/hypercube_graph.h +459 -0
  99. data/ext/lemon-1.3.1/lemon/insertion_tsp.h +533 -0
  100. data/ext/lemon-1.3.1/lemon/karp_mmc.h +590 -0
  101. data/ext/lemon-1.3.1/lemon/kruskal.h +324 -0
  102. data/ext/lemon-1.3.1/lemon/lemon.pc.in +10 -0
  103. data/ext/lemon-1.3.1/lemon/lgf_reader.h +3854 -0
  104. data/ext/lemon-1.3.1/lemon/lgf_writer.h +2687 -0
  105. data/ext/lemon-1.3.1/lemon/list_graph.h +2510 -0
  106. data/ext/lemon-1.3.1/lemon/lp.h +95 -0
  107. data/ext/lemon-1.3.1/lemon/lp_base.cc +30 -0
  108. data/ext/lemon-1.3.1/lemon/lp_base.h +2147 -0
  109. data/ext/lemon-1.3.1/lemon/lp_skeleton.cc +143 -0
  110. data/ext/lemon-1.3.1/lemon/lp_skeleton.h +234 -0
  111. data/ext/lemon-1.3.1/lemon/maps.h +4057 -0
  112. data/ext/lemon-1.3.1/lemon/matching.h +3505 -0
  113. data/ext/lemon-1.3.1/lemon/math.h +77 -0
  114. data/ext/lemon-1.3.1/lemon/max_cardinality_search.h +794 -0
  115. data/ext/lemon-1.3.1/lemon/min_cost_arborescence.h +808 -0
  116. data/ext/lemon-1.3.1/lemon/nagamochi_ibaraki.h +702 -0
  117. data/ext/lemon-1.3.1/lemon/nauty_reader.h +113 -0
  118. data/ext/lemon-1.3.1/lemon/nearest_neighbor_tsp.h +238 -0
  119. data/ext/lemon-1.3.1/lemon/network_simplex.h +1659 -0
  120. data/ext/lemon-1.3.1/lemon/opt2_tsp.h +367 -0
  121. data/ext/lemon-1.3.1/lemon/pairing_heap.h +474 -0
  122. data/ext/lemon-1.3.1/lemon/path.h +1164 -0
  123. data/ext/lemon-1.3.1/lemon/planarity.h +2754 -0
  124. data/ext/lemon-1.3.1/lemon/preflow.h +985 -0
  125. data/ext/lemon-1.3.1/lemon/quad_heap.h +343 -0
  126. data/ext/lemon-1.3.1/lemon/radix_heap.h +438 -0
  127. data/ext/lemon-1.3.1/lemon/radix_sort.h +487 -0
  128. data/ext/lemon-1.3.1/lemon/random.cc +29 -0
  129. data/ext/lemon-1.3.1/lemon/random.h +1005 -0
  130. data/ext/lemon-1.3.1/lemon/smart_graph.h +1344 -0
  131. data/ext/lemon-1.3.1/lemon/soplex.cc +465 -0
  132. data/ext/lemon-1.3.1/lemon/soplex.h +158 -0
  133. data/ext/lemon-1.3.1/lemon/static_graph.h +476 -0
  134. data/ext/lemon-1.3.1/lemon/suurballe.h +776 -0
  135. data/ext/lemon-1.3.1/lemon/time_measure.h +610 -0
  136. data/ext/lemon-1.3.1/lemon/tolerance.h +242 -0
  137. data/ext/lemon-1.3.1/lemon/unionfind.h +1824 -0
  138. data/ext/lemon-1.3.1/scripts/unify-sources.sh +390 -0
  139. data/ext/lemon-1.3.1/scripts/valgrind-wrapper.sh +22 -0
  140. data/ext/lemongraph/arc_map.cc +1007 -0
  141. data/ext/lemongraph/digraph.cc +282 -0
  142. data/ext/lemongraph/digraph_arc.cc +153 -0
  143. data/ext/lemongraph/digraph_node.cc +277 -0
  144. data/ext/lemongraph/edge_map.cc +770 -0
  145. data/ext/lemongraph/extconf.rb +53 -0
  146. data/ext/lemongraph/graph.cc +351 -0
  147. data/ext/lemongraph/graph_arc.cc +95 -0
  148. data/ext/lemongraph/graph_edge.cc +153 -0
  149. data/ext/lemongraph/graph_item.cc +76 -0
  150. data/ext/lemongraph/graph_node.cc +321 -0
  151. data/ext/lemongraph/lemongraph.cc +260 -0
  152. data/ext/lemongraph/lemongraph.hh +295 -0
  153. data/ext/lemongraph/lemongraph.map +6 -0
  154. data/ext/lemongraph/lemongraph_export.hh +31 -0
  155. data/ext/lemongraph/node_map.cc +1011 -0
  156. data/lemongraph.gemspec +176 -0
  157. data/lib/lemongraph/graphviz.rb +240 -0
  158. data/lib/lemongraph/version.rb +4 -0
  159. data/lib/lemongraph.rb +21 -0
  160. data/samples/lemondeps.rb +38 -0
  161. metadata +202 -0
@@ -0,0 +1,204 @@
1
+ /* -*- mode: C++; indent-tabs-mode: nil; -*-
2
+ *
3
+ * This file is a part of LEMON, a generic C++ optimization library.
4
+ *
5
+ * Copyright (C) 2003-2009
6
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
8
+ *
9
+ * Permission to use, modify and distribute this software is granted
10
+ * provided that this copyright notice appears in all copies. For
11
+ * precise terms see the accompanying LICENSE file.
12
+ *
13
+ * This software is provided "AS IS" with no warranty of any kind,
14
+ * express or implied, and with no claim as to its suitability for any
15
+ * purpose.
16
+ *
17
+ */
18
+
19
+ #ifndef LEMON_COLOR_H
20
+ #define LEMON_COLOR_H
21
+
22
+ #include<vector>
23
+ #include<lemon/math.h>
24
+ #include<lemon/maps.h>
25
+
26
+
27
+ ///\ingroup misc
28
+ ///\file
29
+ ///\brief Tools to manage RGB colors.
30
+
31
+ namespace lemon {
32
+
33
+
34
+ /// \addtogroup misc
35
+ /// @{
36
+
37
+ ///Data structure representing RGB colors.
38
+
39
+ ///Data structure representing RGB colors.
40
+ class Color
41
+ {
42
+ double _r,_g,_b;
43
+ public:
44
+ ///Default constructor
45
+ Color() {}
46
+ ///Constructor
47
+ Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};
48
+ ///Set the red component
49
+ double & red() {return _r;}
50
+ ///Return the red component
51
+ const double & red() const {return _r;}
52
+ ///Set the green component
53
+ double & green() {return _g;}
54
+ ///Return the green component
55
+ const double & green() const {return _g;}
56
+ ///Set the blue component
57
+ double & blue() {return _b;}
58
+ ///Return the blue component
59
+ const double & blue() const {return _b;}
60
+ ///Set the color components
61
+ void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
62
+ };
63
+
64
+ /// White color constant
65
+ extern const Color WHITE;
66
+ /// Black color constant
67
+ extern const Color BLACK;
68
+ /// Red color constant
69
+ extern const Color RED;
70
+ /// Green color constant
71
+ extern const Color GREEN;
72
+ /// Blue color constant
73
+ extern const Color BLUE;
74
+ /// Yellow color constant
75
+ extern const Color YELLOW;
76
+ /// Magenta color constant
77
+ extern const Color MAGENTA;
78
+ /// Cyan color constant
79
+ extern const Color CYAN;
80
+ /// Grey color constant
81
+ extern const Color GREY;
82
+ /// Dark red color constant
83
+ extern const Color DARK_RED;
84
+ /// Dark green color constant
85
+ extern const Color DARK_GREEN;
86
+ /// Drak blue color constant
87
+ extern const Color DARK_BLUE;
88
+ /// Dark yellow color constant
89
+ extern const Color DARK_YELLOW;
90
+ /// Dark magenta color constant
91
+ extern const Color DARK_MAGENTA;
92
+ /// Dark cyan color constant
93
+ extern const Color DARK_CYAN;
94
+
95
+ ///Map <tt>int</tt>s to different <tt>Color</tt>s
96
+
97
+ ///This map assigns one of the predefined \ref Color "Color"s to
98
+ ///each <tt>int</tt>. It is possible to change the colors as well as
99
+ ///their number. The integer range is cyclically mapped to the
100
+ ///provided set of colors.
101
+ ///
102
+ ///This is a true \ref concepts::ReferenceMap "reference map", so
103
+ ///you can also change the actual colors.
104
+
105
+ class Palette : public MapBase<int,Color>
106
+ {
107
+ std::vector<Color> colors;
108
+ public:
109
+ ///Constructor
110
+
111
+ ///Constructor.
112
+ ///\param have_white Indicates whether white is among the
113
+ ///provided initial colors (\c true) or not (\c false). If it is true,
114
+ ///white will be assigned to \c 0.
115
+ ///\param num The number of the allocated colors. If it is \c -1,
116
+ ///the default color configuration is set up (26 color plus optionaly the
117
+ ///white). If \c num is less then 26/27 then the default color
118
+ ///list is cut. Otherwise the color list is filled repeatedly with
119
+ ///the default color list. (The colors can be changed later on.)
120
+ Palette(bool have_white=false,int num=-1)
121
+ {
122
+ if (num==0) return;
123
+ do {
124
+ if(have_white) colors.push_back(Color(1,1,1));
125
+
126
+ colors.push_back(Color(0,0,0));
127
+ colors.push_back(Color(1,0,0));
128
+ colors.push_back(Color(0,1,0));
129
+ colors.push_back(Color(0,0,1));
130
+ colors.push_back(Color(1,1,0));
131
+ colors.push_back(Color(1,0,1));
132
+ colors.push_back(Color(0,1,1));
133
+
134
+ colors.push_back(Color(.5,0,0));
135
+ colors.push_back(Color(0,.5,0));
136
+ colors.push_back(Color(0,0,.5));
137
+ colors.push_back(Color(.5,.5,0));
138
+ colors.push_back(Color(.5,0,.5));
139
+ colors.push_back(Color(0,.5,.5));
140
+
141
+ colors.push_back(Color(.5,.5,.5));
142
+ colors.push_back(Color(1,.5,.5));
143
+ colors.push_back(Color(.5,1,.5));
144
+ colors.push_back(Color(.5,.5,1));
145
+ colors.push_back(Color(1,1,.5));
146
+ colors.push_back(Color(1,.5,1));
147
+ colors.push_back(Color(.5,1,1));
148
+
149
+ colors.push_back(Color(1,.5,0));
150
+ colors.push_back(Color(.5,1,0));
151
+ colors.push_back(Color(1,0,.5));
152
+ colors.push_back(Color(0,1,.5));
153
+ colors.push_back(Color(0,.5,1));
154
+ colors.push_back(Color(.5,0,1));
155
+ } while(int(colors.size())<num);
156
+ if(num>=0) colors.resize(num);
157
+ }
158
+ ///\e
159
+ Color &operator[](int i)
160
+ {
161
+ return colors[i%colors.size()];
162
+ }
163
+ ///\e
164
+ const Color &operator[](int i) const
165
+ {
166
+ return colors[i%colors.size()];
167
+ }
168
+ ///\e
169
+ void set(int i,const Color &c)
170
+ {
171
+ colors[i%colors.size()]=c;
172
+ }
173
+ ///Adds a new color to the end of the color list.
174
+ void add(const Color &c)
175
+ {
176
+ colors.push_back(c);
177
+ }
178
+
179
+ ///Sets the number of the existing colors.
180
+ void resize(int s) { colors.resize(s);}
181
+ ///Returns the number of the existing colors.
182
+ int size() const { return int(colors.size());}
183
+ };
184
+
185
+ ///Returns a visibly distinct \ref Color
186
+
187
+ ///Returns a \ref Color which is as different from the given parameter
188
+ ///as it is possible.
189
+ inline Color distantColor(const Color &c)
190
+ {
191
+ return Color(c.red()<.5?1:0,c.green()<.5?1:0,c.blue()<.5?1:0);
192
+ }
193
+ ///Returns black for light colors and white for the dark ones.
194
+
195
+ ///Returns black for light colors and white for the dark ones.
196
+ inline Color distantBW(const Color &c){
197
+ return (.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5 ? WHITE : BLACK;
198
+ }
199
+
200
+ /// @}
201
+
202
+ } //END OF NAMESPACE LEMON
203
+
204
+ #endif // LEMON_COLOR_H
@@ -0,0 +1,77 @@
1
+ /* -*- mode: C++; indent-tabs-mode: nil; -*-
2
+ *
3
+ * This file is a part of LEMON, a generic C++ optimization library.
4
+ *
5
+ * Copyright (C) 2003-2013
6
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
8
+ *
9
+ * Permission to use, modify and distribute this software is granted
10
+ * provided that this copyright notice appears in all copies. For
11
+ * precise terms see the accompanying LICENSE file.
12
+ *
13
+ * This software is provided "AS IS" with no warranty of any kind,
14
+ * express or implied, and with no claim as to its suitability for any
15
+ * purpose.
16
+ *
17
+ */
18
+
19
+ // The contents of this file was inspired by the concept checking
20
+ // utility of the BOOST library (http://www.boost.org).
21
+
22
+ ///\file
23
+ ///\brief Basic utilities for concept checking.
24
+ ///
25
+
26
+ #ifndef LEMON_CONCEPT_CHECK_H
27
+ #define LEMON_CONCEPT_CHECK_H
28
+
29
+ namespace lemon {
30
+
31
+ /*
32
+ "inline" is used for ignore_unused_variable_warning()
33
+ and function_requires() to make sure there is no
34
+ overtarget with g++.
35
+ */
36
+
37
+ template <class T> inline void ignore_unused_variable_warning(const T&) { }
38
+ template <class T1, class T2>
39
+ inline void ignore_unused_variable_warning(const T1&, const T2&) { }
40
+ template <class T1, class T2, class T3>
41
+ inline void ignore_unused_variable_warning(const T1&, const T2&,
42
+ const T3&) { }
43
+ template <class T1, class T2, class T3, class T4>
44
+ inline void ignore_unused_variable_warning(const T1&, const T2&,
45
+ const T3&, const T4&) { }
46
+ template <class T1, class T2, class T3, class T4, class T5>
47
+ inline void ignore_unused_variable_warning(const T1&, const T2&,
48
+ const T3&, const T4&,
49
+ const T5&) { }
50
+ template <class T1, class T2, class T3, class T4, class T5, class T6>
51
+ inline void ignore_unused_variable_warning(const T1&, const T2&,
52
+ const T3&, const T4&,
53
+ const T5&, const T6&) { }
54
+
55
+ ///\e
56
+ template <class Concept>
57
+ inline void function_requires()
58
+ {
59
+ #if !defined(NDEBUG)
60
+ void (Concept::*x)() = & Concept::constraints;
61
+ ::lemon::ignore_unused_variable_warning(x);
62
+ #endif
63
+ }
64
+
65
+ ///\e
66
+ template <typename Concept, typename Type>
67
+ inline void checkConcept() {
68
+ #if !defined(NDEBUG)
69
+ typedef typename Concept::template Constraints<Type> ConceptCheck;
70
+ void (ConceptCheck::*x)() = & ConceptCheck::constraints;
71
+ ::lemon::ignore_unused_variable_warning(x);
72
+ #endif
73
+ }
74
+
75
+ } // namespace lemon
76
+
77
+ #endif // LEMON_CONCEPT_CHECK_H