~ubuntu-branches/ubuntu/dapper/boost/dapper

« back to all changes in this revision

Viewing changes to libs/graph/src/python/module.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Domenico Andreoli, Christophe Prud'homme, Domenico Andreoli
  • Date: 2006-01-11 11:11:42 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060111111142-xy6z1i5himlgu8iw
Tags: 1.33.1-2
[ Christophe Prud'homme ]
* Bug fix: "libboost-wave-dev: Dependency on libboost-filesystem-dev
  missing", thanks to Martin v . Löwis (Closes: #346367).

[ Domenico Andreoli ]
* boost/graph/topological_sort.hpp: removed name of unused parameter
  to prevent long compiler warning.  Closes: #347519.
* Applied patch from upstream CVS to fix parsing of valid options
  with a common root.  Closes: #345714.
* libboost-python-dev now correctly depends on python2.4-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2005 The Trustees of Indiana University.
2
 
 
3
 
// Use, modification and distribution is subject to the Boost Software
4
 
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5
 
// http://www.boost.org/LICENSE_1_0.txt)
6
 
 
7
 
//  Authors: Douglas Gregor
8
 
//           Andrew Lumsdaine
9
 
#include "basic_graph.cpp"
10
 
#include "graph.hpp"
11
 
#include "digraph.hpp"
12
 
#include <boost/python.hpp>
13
 
#include "point2d.hpp"
14
 
#include "generators.hpp"
15
 
 
16
 
namespace boost { namespace graph { namespace python {
17
 
 
18
 
extern void export_Graph();
19
 
extern void export_Digraph();
20
 
extern void export_graphviz();
21
 
extern void export_breadth_first_search();
22
 
extern void export_depth_first_search();
23
 
extern void export_dijkstra_shortest_paths();
24
 
extern void export_bellman_ford_shortest_paths();
25
 
extern void export_dag_shortest_paths();
26
 
extern void export_prim_minimum_spanning_tree();
27
 
template<typename Graph> void export_breadth_first_search_in_graph();
28
 
template<typename Graph> void export_depth_first_search_in_graph();
29
 
template<typename Graph> void export_dijkstra_shortest_paths_in_graph();
30
 
template<typename Graph> void export_dag_shortest_paths_in_graph();
31
 
template<typename Graph> void export_bellman_ford_shortest_paths_in_graph();
32
 
template<typename Graph> void export_prim_minimum_spanning_tree_in_graph();
33
 
extern void export_connected_components();
34
 
extern void export_strong_components();
35
 
extern void export_biconnected_components();
36
 
extern void export_incremental_components();
37
 
extern void export_topological_sort();
38
 
extern void export_cuthill_mckee_ordering();
39
 
extern void export_king_ordering();
40
 
  //extern void export_minimum_degree_ordering();
41
 
extern void export_sequential_vertex_coloring();
42
 
extern void export_betweenness_centrality();
43
 
extern void export_page_rank();
44
 
extern void export_circle_graph_layout();
45
 
extern void export_fruchterman_reingold_force_directed_layout();
46
 
extern void export_kamada_kawai_spring_layout();
47
 
extern void export_kruskal_minimum_spanning_tree();
48
 
extern void export_transitive_closure();
49
 
  //extern void export_transpose_graph();
50
 
extern void export_isomorphism();
51
 
 
52
 
template<typename Graph>
53
 
void export_in_graph()
54
 
{
55
 
  export_breadth_first_search_in_graph<Graph>();
56
 
  export_depth_first_search_in_graph<Graph>();
57
 
  export_dijkstra_shortest_paths_in_graph<Graph>();
58
 
  export_bellman_ford_shortest_paths_in_graph<Graph>();
59
 
  export_dag_shortest_paths_in_graph<Graph>();
60
 
  export_prim_minimum_spanning_tree_in_graph<Graph>();
61
 
}
62
 
 
63
 
BOOST_PYTHON_MODULE(bgl)
64
 
{
65
 
  using boost::python::class_;
66
 
  using boost::python::enum_;
67
 
  using boost::python::no_init;
68
 
  using boost::python::init;
69
 
  using boost::python::arg;
70
 
 
71
 
  enum_<graph_file_kind>("file_kind")
72
 
    .value("adjlist", gfk_adjlist)
73
 
    .value("graphviz", gfk_graphviz)
74
 
    ;
75
 
 
76
 
  enum_<default_color_type>("Color")
77
 
    .value("white", color_traits<default_color_type>::white())
78
 
    .value("gray", color_traits<default_color_type>::gray())
79
 
    .value("black", color_traits<default_color_type>::black())
80
 
    ;
81
 
 
82
 
  class_<point2d>("Point2D")
83
 
    .def_readwrite("x", &point2d::x)
84
 
    .def_readwrite("y", &point2d::y)
85
 
    ;
86
 
 
87
 
  class_<erdos_renyi>("ErdosRenyi", no_init)
88
 
    .def(init<std::size_t, double>(
89
 
           (arg("n"), arg("probability") = 1)))
90
 
    ;
91
 
 
92
 
  class_<power_law_out_degree>("PowerLawOutDegree", no_init)
93
 
    .def(init<std::size_t, double, double>(
94
 
           (arg("n"), arg("alpha"), arg("beta"))))
95
 
    ;
96
 
 
97
 
  class_<small_world>("SmallWorld", no_init)
98
 
    .def(init<std::size_t, std::size_t, double>
99
 
           ((arg("n"), arg("k"), arg("probability"))))
100
 
    ;
101
 
 
102
 
  export_Graph();
103
 
  export_Digraph();
104
 
  export_graphviz();
105
 
  // Core Algorithm Patterns
106
 
  export_breadth_first_search();
107
 
  export_depth_first_search();
108
 
  // Shortest Paths Algorithms
109
 
  export_dijkstra_shortest_paths();
110
 
  export_bellman_ford_shortest_paths();
111
 
  export_dag_shortest_paths();
112
 
  // Minimum Spanning Tree Algorithms
113
 
  export_kruskal_minimum_spanning_tree();
114
 
  export_prim_minimum_spanning_tree();
115
 
  // Connected Components Algorithms
116
 
  export_connected_components();  
117
 
  export_strong_components();  
118
 
  export_biconnected_components();  
119
 
  export_incremental_components();  
120
 
 
121
 
  // Sparse Matrix Ordering
122
 
  export_cuthill_mckee_ordering();
123
 
  export_king_ordering();
124
 
  //  export_minimum_degree_ordering();
125
 
 
126
 
  // Other algorithms
127
 
  export_topological_sort();
128
 
  export_transitive_closure();
129
 
  export_sequential_vertex_coloring();
130
 
  export_betweenness_centrality();
131
 
  export_page_rank();
132
 
 
133
 
  // Layout Algorithms
134
 
  export_circle_graph_layout();
135
 
  export_fruchterman_reingold_force_directed_layout();
136
 
  export_kamada_kawai_spring_layout();
137
 
 
138
 
  //  export_transpose_graph();
139
 
  export_isomorphism();
140
 
}
141
 
 
142
 
template void export_in_graph<Graph>();
143
 
template void export_in_graph<Digraph>();
144
 
 
145
 
} } } // end namespace boost::graph::python