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

Merge branch 'rewiring'

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


parents 1a0e9b5f 981d3b76
......@@ -16,9 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <>.
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,\
textwrap, time, signal, traceback, shutil, time, math, inspect, \
......@@ -42,6 +42,7 @@ libgraph_tool_la_SOURCES = \\\\\\\\
......@@ -130,6 +130,9 @@ public:
void GetCommunityNetwork(string property, string size_property,
string out_file, string format) const;
void RandomRewire(std::string strat, bool self_loops, bool parallel_edges,
size_t seed);
// filtering
void SetDirected(bool directed) {_directed = directed;}
bool GetDirected() const {return _directed;}
......@@ -283,6 +283,7 @@ BOOST_PYTHON_MODULE(libgraph_tool)
.def("GetCommunityNetwork", &GraphInterface::GetCommunityNetwork)
.def("GetModularity", &GraphInterface::GetModularity)
.def("RandomRewire", &GraphInterface::RandomRewire)
.def("SetDirected", &GraphInterface::SetDirected)
.def("GetDirected", &GraphInterface::GetDirected)
.def("SetReversed", &GraphInterface::SetReversed)
This diff is collapsed.
......@@ -615,6 +615,14 @@ class Graph(object):
@_attrs(opt_group=__groups[-1], fist_subopt="parallel_edges")
@_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
__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