Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
dbc89569
Commit
dbc89569
authored
Jan 03, 2014
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce memory usage during compilation for graph_community_network_*.cc
parent
c3cdcdd9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
39 deletions
+95
-39
src/graph/community/Makefile.am
src/graph/community/Makefile.am
+2
-1
src/graph/community/graph_community_network.hh
src/graph/community/graph_community_network.hh
+0
-2
src/graph/community/graph_community_network_eavg.cc
src/graph/community/graph_community_network_eavg.cc
+11
-32
src/graph/community/graph_community_network_eavg_imp1.cc
src/graph/community/graph_community_network_eavg_imp1.cc
+77
-0
src/graph/community/graph_community_network_vavg.cc
src/graph/community/graph_community_network_vavg.cc
+3
-3
src/graph_tool/community/blockmodel.py
src/graph_tool/community/blockmodel.py
+2
-1
No files found.
src/graph/community/Makefile.am
View file @
dbc89569
...
...
@@ -20,7 +20,8 @@ libgraph_tool_community_la_SOURCES = \
graph_community_network.cc
\
graph_community_network_edges.cc
\
graph_community_network_vavg.cc
\
graph_community_network_eavg.cc
graph_community_network_eavg.cc
\
graph_community_network_eavg_imp1.cc
libgraph_tool_community_la_include_HEADERS
=
\
graph_blockmodel.hh
\
...
...
src/graph/community/graph_community_network.hh
View file @
dbc89569
...
...
@@ -378,8 +378,6 @@ struct get_edge_community_property_norm
}
};
}
// graph_tool namespace
#endif // GRAPH_COMMUNITY_NETWORK_HH
src/graph/community/graph_community_network_eavg.cc
View file @
dbc89569
...
...
@@ -48,22 +48,11 @@ struct get_weighted_edge_property_dispatch
}
};
struct
get_edge_sum_dispatch
{
template
<
class
Graph
,
class
CommunityGraph
,
class
CommunityMap
,
class
Eprop
>
void
operator
()(
const
Graph
&
g
,
CommunityGraph
&
cg
,
CommunityMap
s_map
,
boost
::
any
acs_map
,
Eprop
eprop
,
boost
::
any
aceprop
,
bool
self_loops
)
const
{
typename
CommunityMap
::
checked_t
cs_map
=
boost
::
any_cast
<
typename
CommunityMap
::
checked_t
>
(
acs_map
);
typename
Eprop
::
checked_t
ceprop
=
boost
::
any_cast
<
typename
Eprop
::
checked_t
>
(
aceprop
);
get_edge_community_property_sum
()(
g
,
cg
,
s_map
,
cs_map
.
get_unchecked
(
num_vertices
(
cg
)),
eprop
,
ceprop
.
get_unchecked
(
num_edges
(
cg
)),
self_loops
);
}
};
void
sum_eprops
(
GraphInterface
&
gi
,
GraphInterface
&
cgi
,
boost
::
any
community_property
,
boost
::
any
condensed_community_property
,
boost
::
any
ceprop
,
boost
::
any
eprop
,
bool
self_loops
);
void
community_network_eavg
(
GraphInterface
&
gi
,
GraphInterface
&
cgi
,
boost
::
any
community_property
,
...
...
@@ -108,26 +97,16 @@ void community_network_eavg(GraphInterface& gi, GraphInterface& cgi,
(
eweight
,
eprop
);
// sum weighted values
run_action
<
graph_tool
::
detail
::
always_directed
>
()
(
gi
,
std
::
bind
(
get_edge_sum_dispatch
(),
placeholders
::
_1
,
std
::
ref
(
cgi
.
GetGraph
()),
placeholders
::
_2
,
condensed_community_property
,
placeholders
::
_3
,
ceprop
,
self_loops
),
writable_vertex_properties
(),
eprops_t
())
(
community_property
,
temp
);
sum_eprops
(
gi
,
cgi
,
community_property
,
condensed_community_property
,
ceprop
,
temp
,
self_loops
);
}
else
{
// sum unweighted values
run_action
<
graph_tool
::
detail
::
always_directed
>
()
(
gi
,
std
::
bind
(
get_edge_sum_dispatch
(),
placeholders
::
_1
,
std
::
ref
(
cgi
.
GetGraph
()),
placeholders
::
_2
,
condensed_community_property
,
placeholders
::
_3
,
ceprop
,
self_loops
),
writable_vertex_properties
(),
eprops_t
())
(
community_property
,
eprop
);
sum_eprops
(
gi
,
cgi
,
community_property
,
condensed_community_property
,
ceprop
,
eprop
,
self_loops
);
}
// norm summed values
...
...
src/graph/community/graph_community_network_eavg_imp1.cc
0 → 100644
View file @
dbc89569
// graph-tool -- a general graph modification and manipulation thingy
//
// Copyright (C) 2006-2014 Tiago de Paula Peixoto <tiago@skewed.de>
//
// 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 3
// 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, see <http://www.gnu.org/licenses/>.
#include "graph_python_interface.hh"
#include "graph_filtering.hh"
#include "graph.hh"
#include "graph_selectors.hh"
#include "graph_properties.hh"
#include <boost/bind.hpp>
#include <boost/bind/placeholders.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/python.hpp>
#include "graph_community_network.hh"
using
namespace
std
;
using
namespace
boost
;
using
namespace
graph_tool
;
typedef
ConstantPropertyMap
<
int32_t
,
GraphInterface
::
edge_t
>
no_eweight_map_t
;
typedef
property_map_type
::
apply
<
int32_t
,
GraphInterface
::
edge_index_map_t
>::
type
ecount_map_t
;
struct
get_edge_sum_dispatch
{
template
<
class
Graph
,
class
CommunityGraph
,
class
CommunityMap
,
class
Eprop
>
void
operator
()(
const
Graph
&
g
,
CommunityGraph
&
cg
,
CommunityMap
s_map
,
boost
::
any
acs_map
,
Eprop
eprop
,
boost
::
any
aceprop
,
bool
self_loops
)
const
{
typename
CommunityMap
::
checked_t
cs_map
=
boost
::
any_cast
<
typename
CommunityMap
::
checked_t
>
(
acs_map
);
typename
Eprop
::
checked_t
ceprop
=
boost
::
any_cast
<
typename
Eprop
::
checked_t
>
(
aceprop
);
get_edge_community_property_sum
()(
g
,
cg
,
s_map
,
cs_map
.
get_unchecked
(
num_vertices
(
cg
)),
eprop
,
ceprop
.
get_unchecked
(
num_edges
(
cg
)),
self_loops
);
}
};
void
sum_eprops
(
GraphInterface
&
gi
,
GraphInterface
&
cgi
,
boost
::
any
community_property
,
boost
::
any
condensed_community_property
,
boost
::
any
ceprop
,
boost
::
any
eprop
,
bool
self_loops
)
{
typedef
boost
::
mpl
::
insert_range
<
writable_edge_scalar_properties
,
boost
::
mpl
::
end
<
writable_edge_scalar_properties
>::
type
,
edge_scalar_vector_properties
>::
type
eprops_temp
;
typedef
boost
::
mpl
::
push_back
<
eprops_temp
,
property_map_type
::
apply
<
boost
::
python
::
object
,
GraphInterface
::
edge_index_map_t
>::
type
>::
type
eprops_t
;
run_action
<
graph_tool
::
detail
::
always_directed
>
()
(
gi
,
std
::
bind
(
get_edge_sum_dispatch
(),
placeholders
::
_1
,
std
::
ref
(
cgi
.
GetGraph
()),
placeholders
::
_2
,
condensed_community_property
,
placeholders
::
_3
,
ceprop
,
self_loops
),
writable_vertex_properties
(),
eprops_t
())
(
community_property
,
eprop
);
}
src/graph/community/graph_community_network_vavg.cc
View file @
dbc89569
...
...
@@ -98,7 +98,7 @@ void community_network_vavg(GraphInterface& gi, GraphInterface& cgi,
if
(
!
no_weight
)
{
// compute weighted values to temp
run_action
<
graph_tool
::
detail
::
always_directed
>
()
run_action
<
graph_tool
::
detail
::
always_directed
_never_reversed
>
()
(
gi
,
std
::
bind
(
get_weighted_vertex_property_dispatch
(),
placeholders
::
_1
,
placeholders
::
_2
,
placeholders
::
_3
,
temp
),
...
...
@@ -106,7 +106,7 @@ void community_network_vavg(GraphInterface& gi, GraphInterface& cgi,
(
vweight
,
vprop
);
// sum weighted values
run_action
<
graph_tool
::
detail
::
always_directed
>
()
run_action
<
graph_tool
::
detail
::
always_directed
_never_reversed
>
()
(
gi
,
std
::
bind
(
get_vertex_sum_dispatch
(),
placeholders
::
_1
,
std
::
ref
(
cgi
.
GetGraph
()),
placeholders
::
_2
,
...
...
@@ -118,7 +118,7 @@ void community_network_vavg(GraphInterface& gi, GraphInterface& cgi,
else
{
// sum unweighted values
run_action
<
graph_tool
::
detail
::
always_directed
>
()
run_action
<
graph_tool
::
detail
::
always_directed
_never_reversed
>
()
(
gi
,
std
::
bind
(
get_vertex_sum_dispatch
(),
placeholders
::
_1
,
std
::
ref
(
cgi
.
GetGraph
()),
placeholders
::
_2
,
...
...
src/graph_tool/community/blockmodel.py
View file @
dbc89569
...
...
@@ -2201,7 +2201,7 @@ def condensation_graph(g, prop, vweight=None, eweight=None, avprops=None,
_prop
(
"v"
,
g
,
vweight
),
_prop
(
"e"
,
g
,
eweight
),
self_loops
)
u
=
GraphView
(
g
,
directed
=
True
)
u
=
GraphView
(
g
,
directed
=
True
,
reversed
=
False
)
libcommunity
.
community_network_vavg
(
u
.
_Graph__graph
,
gp
.
_Graph__graph
,
_prop
(
"v"
,
g
,
prop
),
...
...
@@ -2209,6 +2209,7 @@ def condensation_graph(g, prop, vweight=None, eweight=None, avprops=None,
_prop
(
"v"
,
gp
,
vcount
),
_prop
(
"v"
,
g
,
vweight
),
avp
)
u
=
GraphView
(
g
,
directed
=
True
)
libcommunity
.
community_network_eavg
(
u
.
_Graph__graph
,
gp
.
_Graph__graph
,
_prop
(
"v"
,
g
,
prop
),
...
...
Write
Preview
Markdown
is supported
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