Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
4f894336
Commit
4f894336
authored
Oct 28, 2012
by
Tiago Peixoto
Browse files
Fix compilation issues with Boost 1.51
parent
8961b6ce
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/graph/clustering/graph_motifs.cc
View file @
4f894336
...
...
@@ -20,6 +20,7 @@
#include
"graph.hh"
#include
"graph_selectors.hh"
#include
"graph_properties.hh"
#include
"graph_util.hh"
#include
"graph_motifs.hh"
...
...
@@ -29,11 +30,6 @@ using namespace std;
using
namespace
boost
;
using
namespace
graph_tool
;
struct
null_copy
{
template
<
class
T1
,
class
T2
>
void
operator
()(
const
T1
&
,
const
T2
&
)
const
{}
};
struct
append_to_list
{
...
...
@@ -46,8 +42,7 @@ struct append_to_list
u_graph_t
>::
type
graph_t
;
vector
<
graph_t
>&
glist
=
any_cast
<
vector
<
graph_t
>&>
(
list
);
glist
.
push_back
(
graph_t
());
copy_graph
(
g
,
glist
.
back
(),
vertex_copy
(
null_copy
()).
edge_copy
(
null_copy
()));
graph_copy
(
g
,
glist
.
back
());
}
};
...
...
@@ -65,8 +60,7 @@ struct retrieve_from_list
done
=
true
;
return
;
}
copy_graph
(
glist
.
back
(),
g
,
edge_copy
(
null_copy
()));
glist
.
pop_back
();
graph_copy
(
glist
.
back
(),
g
);
}
};
...
...
src/graph/clustering/graph_motifs.hh
View file @
4f894336
...
...
@@ -18,11 +18,6 @@
#ifndef GRAPH_MOTIFS_HH
#define GRAPH_MOTIFS_HH
#if (BOOST_VERSION / 100 % 1000 >= 49)
#include
<boost/graph/copy_alt.hpp>
#else
#include
<boost/graph/copy.hpp>
#endif
#include
<boost/graph/isomorphism.hpp>
#if (GCC_VERSION >= 40400)
# include <tr1/unordered_set>
...
...
src/graph/flow/graph_edmonds_karp.cc
View file @
4f894336
...
...
@@ -31,24 +31,29 @@ using namespace boost;
struct
get_edmonds_karp_max_flow
{
template
<
class
Graph
,
class
EdgeIndex
,
class
CapacityMap
,
template
<
class
Graph
,
class
VertexIndex
,
class
EdgeIndex
,
class
CapacityMap
,
class
ResidualMap
>
void
operator
()(
Graph
&
g
,
EdgeIndex
edge_index
,
size_t
max_e
,
size_t
src
,
size_t
sink
,
CapacityMap
cm
,
ResidualMap
res
)
const
void
operator
()(
Graph
&
g
,
VertexIndex
vertex_index
,
EdgeIndex
edge_index
,
size_t
max_e
,
size_t
src
,
size_t
sink
,
CapacityMap
cm
,
ResidualMap
res
)
const
{
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_t
;
unchecked_vector_property_map
<
bool
,
EdgeIndex
>
augmented
(
edge_index
,
max_e
);
unchecked_vector_property_map
<
edge_t
,
EdgeIndex
>
reverse_map
(
edge_index
,
max_e
);
unchecked_vector_property_map
<
default_color_type
,
VertexIndex
>
color
(
vertex_index
,
num_vertices
(
g
));
unchecked_vector_property_map
<
edge_t
,
VertexIndex
>
pred
(
vertex_index
,
num_vertices
(
g
));
augment_graph
(
g
,
augmented
.
get_checked
(),
cm
,
reverse_map
.
get_checked
(),
res
);
boost
::
edmonds_karp_max_flow
(
g
.
_g
,
vertex
(
src
,
g
),
vertex
(
sink
,
g
),
capacity_map
(
get_unchecked
(
cm
)
).
re
verse_edge_map
(
reverse_map
).
re
sidual_capacity_map
(
res
.
get_unchecked
())
);
get_unchecked
(
cm
)
,
re
s
.
get_unchecked
(),
re
verse_map
,
color
,
pred
);
deaugment_graph
(
g
,
augmented
.
get_checked
());
}
...
...
@@ -60,7 +65,8 @@ void edmonds_karp_max_flow(GraphInterface& gi, size_t src, size_t sink,
{
run_action
<
graph_tool
::
detail
::
always_directed
,
mpl
::
true_
>
()
(
gi
,
bind
<
void
>
(
get_edmonds_karp_max_flow
(),
_1
,
gi
.
GetEdgeIndex
(),
gi
.
GetMaxEdgeIndex
(),
_1
,
gi
.
GetVertexIndex
(),
gi
.
GetEdgeIndex
(),
gi
.
GetMaxEdgeIndex
(),
src
,
sink
,
_2
,
_3
),
edge_scalar_properties
(),
writable_edge_scalar_properties
())
(
capacity
,
res
);
...
...
src/graph/flow/graph_push_relabel.cc
View file @
4f894336
...
...
@@ -55,10 +55,11 @@ using namespace boost;
struct
get_push_relabel_max_flow
{
template
<
class
Graph
,
class
EdgeIndex
,
class
CapacityMap
,
template
<
class
Graph
,
class
VertexIndex
,
class
EdgeIndex
,
class
CapacityMap
,
class
ResidualMap
>
void
operator
()(
Graph
&
g
,
EdgeIndex
edge_index
,
size_t
max_e
,
size_t
src
,
size_t
sink
,
CapacityMap
cm
,
ResidualMap
res
)
const
void
operator
()(
Graph
&
g
,
VertexIndex
vertex_index
,
EdgeIndex
edge_index
,
size_t
max_e
,
size_t
src
,
size_t
sink
,
CapacityMap
cm
,
ResidualMap
res
)
const
{
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_t
;
checked_vector_property_map
<
bool
,
EdgeIndex
>
...
...
@@ -70,10 +71,9 @@ struct get_push_relabel_max_flow
reverse_map
.
get_checked
(),
res
);
boost
::
push_relabel_max_flow
(
g
.
_g
,
vertex
(
src
,
g
),
vertex
(
sink
,
g
),
capacity_map
(
get_unchecked
(
cm
)).
reverse_edge_map
(
reverse_map
).
residual_capacity_map
(
res
.
get_unchecked
()));
get_unchecked
(
cm
),
res
.
get_unchecked
(),
reverse_map
,
vertex_index
);
deaugment_graph
(
g
,
augmented
);
}
};
...
...
@@ -84,7 +84,8 @@ void push_relabel_max_flow(GraphInterface& gi, size_t src, size_t sink,
{
run_action
<
graph_tool
::
detail
::
always_directed
,
mpl
::
true_
>
()
(
gi
,
bind
<
void
>
(
get_push_relabel_max_flow
(),
_1
,
gi
.
GetEdgeIndex
(),
gi
.
GetMaxEdgeIndex
(),
_1
,
gi
.
GetVertexIndex
(),
gi
.
GetEdgeIndex
(),
gi
.
GetMaxEdgeIndex
(),
src
,
sink
,
_2
,
_3
),
edge_scalar_properties
(),
writable_edge_scalar_properties
())
(
capacity
,
res
);
...
...
src/graph/generation/graph_rewiring.cc
View file @
4f894336
...
...
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include
"graph_python_interface.hh"
#include
"graph.hh"
#include
"graph_filtering.hh"
...
...
@@ -24,14 +25,15 @@
# include <boost/tr1/random.hpp>
#endif
#include
"graph_rewiring.hh"
#include
<boost/bind.hpp>
#include
<boost/python.hpp>
#include
"graph_rewiring.hh"
using
namespace
graph_tool
;
using
namespace
boost
;
class
PythonFuncWrap
{
public:
...
...
src/graph/graph_adaptor.hh
View file @
4f894336
...
...
@@ -73,6 +73,8 @@ public:
const
Graph
&
OriginalGraph
()
const
{
return
_g
;}
Graph
&
OriginalGraph
()
{
return
_g
;}
static
vertex_descriptor
null_vertex
()
{
graph_traits
<
Graph
>::
null_vertex
();}
private:
Graph
&
_g
;
};
...
...
src/graph/graph_copy.cc
View file @
4f894336
...
...
@@ -26,7 +26,7 @@ using namespace std;
using
namespace
boost
;
using
namespace
graph_tool
;
struct
graph_copy
struct
do_
graph_copy
{
template
<
class
GraphDst
,
class
GraphSrc
,
class
DstVertexIndexMap
,
class
SrcVertexIndexMap
,
class
DstEdgeIndexMap
,
...
...
@@ -82,7 +82,7 @@ GraphInterface::GraphInterface(const GraphInterface& gi, bool keep_ref)
run_action
<>
()
(
const_cast
<
GraphInterface
&>
(
gi
),
bind
<
void
>
(
graph_copy
(),
_1
,
ref
(
_state
->
_mg
),
bind
<
void
>
(
do_
graph_copy
(),
_1
,
ref
(
_state
->
_mg
),
gi
.
_vertex_index
,
_vertex_index
,
gi
.
_edge_index
,
_edge_index
))();
// filters will be copied in python
...
...
src/graph/graph_properties.cc
View file @
4f894336
...
...
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include
"graph_python_interface.hh"
#include
"graph.hh"
#include
"graph_properties.hh"
#include
"graph_filtering.hh"
...
...
src/graph/graph_python_interface.cc
View file @
4f894336
...
...
@@ -26,6 +26,14 @@ using namespace std;
using
namespace
boost
;
using
namespace
graph_tool
;
namespace
boost
{
size_t
hash_value
(
const
boost
::
python
::
object
&
o
)
{
return
boost
::
python
::
extract
<
size_t
>
(
o
.
attr
(
"__hash__"
)());
}
}
namespace
graph_tool
{
...
...
src/graph/graph_python_interface.hh
View file @
4f894336
...
...
@@ -18,6 +18,15 @@
#ifndef PYTHON_INTERFACE_HH
#define PYTHON_INTERFACE_HH
#include
<boost/python.hpp>
#include
<boost/python/type_id.hpp>
namespace
boost
{
size_t
hash_value
(
const
boost
::
python
::
object
&
o
);
}
#include
<boost/graph/graph_traits.hpp>
#include
<boost/mpl/logical.hpp>
#include
<boost/functional/hash.hpp>
...
...
@@ -28,8 +37,6 @@
#include
"graph_selectors.hh"
#include
"numpy_bind.hh"
#include
<boost/python.hpp>
#include
<boost/python/type_id.hpp>
// this file includes a simple python interface for the internally kept
// graph. It defines a PythonVertex, PythonEdge and PythonIterator template
...
...
src/graph/graph_util.hh
View file @
4f894336
...
...
@@ -151,6 +151,21 @@ out_degree_no_loops_weighted(typename graph_traits<Graph>::vertex_descriptor v,
}
template
<
class
GraphOrig
,
class
GraphTarget
>
void
graph_copy
(
const
GraphOrig
&
g
,
GraphTarget
&
gt
)
{
typename
property_map
<
GraphOrig
,
vertex_index_t
>::
type
index
=
get
(
vertex_index
,
g
);
typedef
typename
graph_traits
<
GraphOrig
>::
vertex_descriptor
vertex_t
;
typedef
typename
graph_traits
<
GraphTarget
>::
vertex_descriptor
tvertex_t
;
vector
<
tvertex_t
>
vmap
;
typename
graph_traits
<
GraphOrig
>::
vertex_iterator
v
,
v_end
;
for
(
tie
(
v
,
v_end
)
=
vertices
(
g
);
v
!=
v_end
;
++
v
)
vmap
[
index
[
*
v
]]
=
add_vertex
(
gt
);
typename
graph_traits
<
GraphOrig
>::
edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
edges
(
g
);
e
!=
e_end
;
++
e
)
add_edge
(
vmap
[
index
[
source
(
*
e
,
g
)]],
vmap
[
index
[
target
(
*
e
,
g
)]],
gt
);
}
}
// namespace graph_tool
...
...
Tiago Peixoto
@count0
mentioned in issue
#95 (closed)
·
Aug 06, 2014
mentioned in issue
#95 (closed)
mentioned in issue #95
Toggle commit list
Tiago Peixoto
@count0
mentioned in issue
#96 (closed)
·
Aug 06, 2014
mentioned in issue
#96 (closed)
mentioned in issue #96
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment