Commit d0cf197c authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Merge branch 'rewiring'

Improve formatting of src/graph/graph_rewiring.cc (line breaks at column
80, typedefs, trailing whitespace removal, etc)

Conflicts:

	src/graph-tool
	src/graph/graph_bind.cc
parents 1a0e9b5f 981d3b76
...@@ -16,9 +16,8 @@ ...@@ -16,9 +16,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from graph_tool import * from graph_tool import *
from graph_tool import libgraph_tool from graph_tool import libgraph_tool, _eval_expr, _open_file
import sys, os, os.path, re, struct, fcntl, termios, gzip, bz2, string,\ import sys, os, os.path, re, struct, fcntl, termios, gzip, bz2, string,\
textwrap, time, signal, traceback, shutil, time, math, inspect, \ textwrap, time, signal, traceback, shutil, time, math, inspect, \
......
...@@ -42,6 +42,7 @@ libgraph_tool_la_SOURCES = \ ...@@ -42,6 +42,7 @@ libgraph_tool_la_SOURCES = \
graph_community_network.cc\ graph_community_network.cc\
graph_line_graph.cc\ graph_line_graph.cc\
graph_betweenness.cc\ graph_betweenness.cc\
graph_rewiring.cc\
graph_layout.cc\ graph_layout.cc\
graph_io.cc\ graph_io.cc\
graph_bind.cc\ graph_bind.cc\
......
...@@ -130,6 +130,9 @@ public: ...@@ -130,6 +130,9 @@ public:
void GetCommunityNetwork(string property, string size_property, void GetCommunityNetwork(string property, string size_property,
string out_file, string format) const; string out_file, string format) const;
void RandomRewire(std::string strat, bool self_loops, bool parallel_edges,
size_t seed);
// filtering // filtering
void SetDirected(bool directed) {_directed = directed;} void SetDirected(bool directed) {_directed = directed;}
bool GetDirected() const {return _directed;} bool GetDirected() const {return _directed;}
......
...@@ -283,6 +283,7 @@ BOOST_PYTHON_MODULE(libgraph_tool) ...@@ -283,6 +283,7 @@ BOOST_PYTHON_MODULE(libgraph_tool)
&GraphInterface::GetCommunityStructure) &GraphInterface::GetCommunityStructure)
.def("GetCommunityNetwork", &GraphInterface::GetCommunityNetwork) .def("GetCommunityNetwork", &GraphInterface::GetCommunityNetwork)
.def("GetModularity", &GraphInterface::GetModularity) .def("GetModularity", &GraphInterface::GetModularity)
.def("RandomRewire", &GraphInterface::RandomRewire)
.def("SetDirected", &GraphInterface::SetDirected) .def("SetDirected", &GraphInterface::SetDirected)
.def("GetDirected", &GraphInterface::GetDirected) .def("GetDirected", &GraphInterface::GetDirected)
.def("SetReversed", &GraphInterface::SetReversed) .def("SetReversed", &GraphInterface::SetReversed)
......
This diff is collapsed.
...@@ -615,6 +615,14 @@ class Graph(object): ...@@ -615,6 +615,14 @@ class Graph(object):
self.__graph.PurgeEdges() self.__graph.PurgeEdges()
self.__graph.SetEdgeFilterProperty('') self.__graph.SetEdgeFilterProperty('')
@_attrs(opt_group=__groups[-1], fist_subopt="parallel_edges")
@_handle_exceptions
@_limit_args({"strategy":["correlated", "uncorrelated"]})
def random_rewire(self, strategy="uncorrelated", parallel_edges=False,
self_loops=False, seed=int(time.time())):
"""Randomly rewire the edges of the graph"""
self.__graph.RandomRewire(strategy, self_loops, parallel_edges, seed)
# Basic graph statistics # Basic graph statistics
__groups.append("Basic Statistics") __groups.append("Basic Statistics")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment