diff --git a/src/graph_tool/__init__.py b/src/graph_tool/__init__.py
index d60a70be7b4beeb498a2980ea4332d0a8e13e924..ae980d6b5dfe9e0b9d5675e2272312b431374010 100644
--- a/src/graph_tool/__init__.py
+++ b/src/graph_tool/__init__.py
@@ -100,7 +100,6 @@ __URL__ = "http://graph-tool.skewed.de"
import numpy
import numpy.ma
import scipy
-import scipy.stats
from .dl_import import *
@@ -126,8 +125,7 @@ import collections.abc
import itertools
import csv
-from .decorators import _require, _attrs, _limit_args, _copy_func
-from inspect import ismethod
+from .decorators import _require, _limit_args, _copy_func
__all__ = ["Graph", "GraphView", "Vertex", "Edge", "VertexBase", "EdgeBase",
"Vector_bool", "Vector_int16_t", "Vector_int32_t", "Vector_int64_t",
diff --git a/src/graph_tool/clustering/__init__.py b/src/graph_tool/clustering/__init__.py
index 5987f2316fab1b765aec414dd4d34325a51f4161..1f7e891218fe0aff8ef679bb1feb70d532d2d26a 100644
--- a/src/graph_tool/clustering/__init__.py
+++ b/src/graph_tool/clustering/__init__.py
@@ -44,14 +44,13 @@ Contents
from .. dl_import import dl_import
dl_import("from . import libgraph_tool_clustering as _gt")
-from .. import _degree, _prop, Graph, GraphView, VertexPropertyMap, _get_rng
+from .. import _prop, Graph, GraphView, VertexPropertyMap, _get_rng
from .. topology import isomorphism
from .. generation import random_rewire
from .. stats import vertex_hist
from collections import defaultdict
from numpy import *
-from numpy import random
__all__ = ["local_clustering", "global_clustering", "extended_clustering",
"motifs", "motif_significance"]
diff --git a/src/graph_tool/dl_import.py b/src/graph_tool/dl_import.py
index bf7656a16fcafac0b46ef943d667fbf9a8695c2c..2b6db684f3159ad296dc624c5c6a26d09a2b286e 100644
--- a/src/graph_tool/dl_import.py
+++ b/src/graph_tool/dl_import.py
@@ -19,7 +19,6 @@
# along with this program. If not, see .
import sys
-import os.path
try:
from os import RTLD_LAZY, RTLD_GLOBAL
diff --git a/src/graph_tool/draw/__init__.py b/src/graph_tool/draw/__init__.py
index df3396e189e332585dc13e35c229977ff309c12f..2b57ffee0f0b55f88fb9c998ff895c3f6edd68ee 100644
--- a/src/graph_tool/draw/__init__.py
+++ b/src/graph_tool/draw/__init__.py
@@ -70,9 +70,7 @@ from .. import Graph, GraphView, _check_prop_vector, _check_prop_scalar, \
group_vector_property, ungroup_vector_property, infect_vertex_property, \
_prop, _get_rng
from .. topology import max_cardinality_matching, max_independent_vertex_set, \
- label_components, pseudo_diameter, shortest_distance, make_maximal_planar, \
- is_planar
-from .. stats import label_parallel_edges
+ label_components, shortest_distance, make_maximal_planar, is_planar
from .. generation import predecessor_tree, condensation_graph
import numpy.random
from numpy import sqrt
diff --git a/src/graph_tool/draw/cairo_draw.py b/src/graph_tool/draw/cairo_draw.py
index ae70170cdbb7400b2f8f88584ed905517e0e67e1..62f6335d45533228acbdd0ce3d835efed62ab4af 100644
--- a/src/graph_tool/draw/cairo_draw.py
+++ b/src/graph_tool/draw/cairo_draw.py
@@ -89,7 +89,7 @@ except ImportError:
warnings.warn(msg, RuntimeWarning)
from .. draw import sfdp_layout, random_layout, _avg_edge_distance, \
- coarse_graphs, radial_tree_layout, prop_to_size
+ radial_tree_layout, prop_to_size
from .. generation import graph_union
from .. topology import shortest_path
diff --git a/src/graph_tool/draw/graphviz_draw.py b/src/graph_tool/draw/graphviz_draw.py
index 7c5594ec9c2d2b9c6bfadc27b2d87d314c3951ba..bc0da32280bb2310b0de026313c5cdab16acf0a6 100644
--- a/src/graph_tool/draw/graphviz_draw.py
+++ b/src/graph_tool/draw/graphviz_draw.py
@@ -21,7 +21,6 @@
import sys
import os
import os.path
-import time
import warnings
import ctypes
import ctypes.util
diff --git a/src/graph_tool/draw/gtk_draw.py b/src/graph_tool/draw/gtk_draw.py
index a846ce21e821de0f455a226b21c2f5f72f28aa6e..e7d22013edc06b397f1c31e7fd0e668f83598aa9 100644
--- a/src/graph_tool/draw/gtk_draw.py
+++ b/src/graph_tool/draw/gtk_draw.py
@@ -20,11 +20,10 @@
import numpy
-from .. import GraphView, PropertyMap, VertexPropertyMap, \
- ungroup_vector_property, group_vector_property, infect_vertex_property, \
- edge_endpoint_property, _prop
+from .. import GraphView, PropertyMap, ungroup_vector_property, \
+ group_vector_property, infect_vertex_property, edge_endpoint_property, _prop
from .cairo_draw import *
-from .cairo_draw import _vdefaults, _edefaults
+from .cairo_draw import _edefaults
from .. draw import sfdp_layout, random_layout, _avg_edge_distance, \
coarse_graphs
diff --git a/src/graph_tool/generation/__init__.py b/src/graph_tool/generation/__init__.py
index 91843e10b32132acfe646b46e147258af2a20e35..26d9d0cd03abb04ecde3deb93ac5acde56b08cf8 100644
--- a/src/graph_tool/generation/__init__.py
+++ b/src/graph_tool/generation/__init__.py
@@ -52,8 +52,7 @@ from .. dl_import import dl_import
dl_import("from . import libgraph_tool_generation")
from .. import Graph, GraphView, _check_prop_scalar, _prop, _limit_args, \
- _gt_type, _get_rng, libcore, Vector_double
-from .. stats import label_parallel_edges, label_self_loops
+ _gt_type, _get_rng, Vector_double
import inspect
import types
import numpy
@@ -2372,4 +2371,4 @@ class DynamicSampler(libgraph_tool_generation.DynamicSampler):
libgraph_tool_generation.DynamicSampler.__init__(self, values, probs)
def sample(self):
- return libgraph_tool_generation.DynamicSampler.sample(self, _get_rng())
\ No newline at end of file
+ return libgraph_tool_generation.DynamicSampler.sample(self, _get_rng())
diff --git a/src/graph_tool/gt_io.py b/src/graph_tool/gt_io.py
index 22aabc5926824a8401e63496f567a016b62b41df..57370d53d43b367ef2d5f73bd22ffaf861e69f6a 100644
--- a/src/graph_tool/gt_io.py
+++ b/src/graph_tool/gt_io.py
@@ -19,7 +19,6 @@
# along with this program. If not, see .
import pickle
-import base64
import atexit
from io import BytesIO
from . import libgraph_tool_core
diff --git a/src/graph_tool/inference/blockmodel.py b/src/graph_tool/inference/blockmodel.py
index 51486b86768222edb8389b44d692e12ce0e0784b..10062962a1fde14f5961e34c2ff6716739a8a0ac 100644
--- a/src/graph_tool/inference/blockmodel.py
+++ b/src/graph_tool/inference/blockmodel.py
@@ -18,12 +18,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView, libcore, _get_rng, \
- PropertyMap, VertexPropertyMap, Vector_size_t, Vector_double, \
- group_vector_property, perfect_prop_hash
+from .. import _prop, Graph, libcore, _get_rng, PropertyMap, \
+ VertexPropertyMap, Vector_size_t, Vector_double, group_vector_property, \
+ perfect_prop_hash
from .. generation import condensation_graph, random_rewire, generate_sbm, \
solve_sbm_fugacities, generate_maxent_sbm
-from .. stats import label_self_loops, remove_parallel_edges, remove_self_loops
+from .. stats import remove_parallel_edges, remove_self_loops
from .. spectral import adjacency
import random
from numpy import *
@@ -2573,4 +2573,4 @@ def microstate_entropy(h, unlabel=True):
return libinference.partitions_entropy(h, unlabel)
-from . overlap_blockmodel import *
\ No newline at end of file
+from . overlap_blockmodel import *
diff --git a/src/graph_tool/inference/blockmodel_em.py b/src/graph_tool/inference/blockmodel_em.py
index 365addd581fbfe7f4c8bd521a04cb5c2702a498c..b4ce93258134275bacbc49c85d041ae00ba55f84 100644
--- a/src/graph_tool/inference/blockmodel_em.py
+++ b/src/graph_tool/inference/blockmodel_em.py
@@ -18,16 +18,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView, libcore, _get_rng, PropertyMap, \
- Vector_size_t, Vector_double, group_vector_property
-from .. generation import condensation_graph
-from .. stats import label_self_loops
-from .. spectral import adjacency
+from .. import _prop, _get_rng, group_vector_property
import random
from numpy import *
-import numpy
-import copy
-import collections
from . blockmodel import *
from . util import *
@@ -288,4 +281,4 @@ def em_infer(state, max_iter=1000, max_e_iter=1, epsilon=1e-3,
break
if verbose:
print(niter, delta)
- return delta, niter
\ No newline at end of file
+ return delta, niter
diff --git a/src/graph_tool/inference/layered_blockmodel.py b/src/graph_tool/inference/layered_blockmodel.py
index b032b867fef01e3b0eeeb219c09f47df3ccb8a8a..43d82cc8554d18c185e561c3f4d85d4d1c04602d 100644
--- a/src/graph_tool/inference/layered_blockmodel.py
+++ b/src/graph_tool/inference/layered_blockmodel.py
@@ -18,23 +18,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView, libcore, _get_rng, PropertyMap
-import random
+from .. import _prop, Graph, GraphView, libcore, _get_rng
from numpy import *
import numpy
-from collections import defaultdict
-from scipy.special import gammaln
import copy
import warnings
-from .. import group_vector_property, ungroup_vector_property, Vector_size_t, \
- perfect_prop_hash
+from .. import group_vector_property, ungroup_vector_property, perfect_prop_hash
from .. dl_import import dl_import
dl_import("from . import libgraph_tool_inference as libinference")
from .. generation import graph_union
-from .. stats import vertex_hist
from . blockmodel import *
from . blockmodel import _bm_test
@@ -1115,4 +1110,4 @@ def init_layer_confined(g, ec):
ba.fa = ba.fa + ec.fa * (ba.fa.max() + 1)
continuous_map(ba)
be = group_vector_property([ba, ba])
- return be
\ No newline at end of file
+ return be
diff --git a/src/graph_tool/inference/nested_blockmodel.py b/src/graph_tool/inference/nested_blockmodel.py
index fc98692de69b925a818a37b181c5de606d31232c..7175de1d88f1031d448d5f66bdd45164a92bbbaa 100644
--- a/src/graph_tool/inference/nested_blockmodel.py
+++ b/src/graph_tool/inference/nested_blockmodel.py
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView
+from .. import _prop, Graph, GraphView
from . blockmodel import *
from . blockmodel import _bm_test
from . overlap_blockmodel import *
diff --git a/src/graph_tool/inference/overlap_blockmodel.py b/src/graph_tool/inference/overlap_blockmodel.py
index 17f0e4eb2ddc00c6ad002f42a095c1047712d78e..8170e80118c8b39a82842a815f6d6a4e79d5dcfa 100644
--- a/src/graph_tool/inference/overlap_blockmodel.py
+++ b/src/graph_tool/inference/overlap_blockmodel.py
@@ -18,12 +18,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView, libcore, _get_rng, PropertyMap
+from .. import _prop, Graph, libcore, _get_rng, PropertyMap
import random
from numpy import *
import numpy
-from collections import defaultdict
from .. import group_vector_property, ungroup_vector_property
diff --git a/src/graph_tool/inference/partition_centroid.py b/src/graph_tool/inference/partition_centroid.py
index a6d2c73f0a3fdf9e00a16b2eb431f188ea3d9573..b782257819cc144ecf7ca59ac155ea15ad2ae096 100644
--- a/src/graph_tool/inference/partition_centroid.py
+++ b/src/graph_tool/inference/partition_centroid.py
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView, _get_rng, Vector_size_t
+from .. import Graph, _get_rng, Vector_size_t
from . blockmodel import DictState, get_entropy_args, _bm_test
from .. dl_import import dl_import
diff --git a/src/graph_tool/inference/partition_modes.py b/src/graph_tool/inference/partition_modes.py
index 6f9347f25ca809e9dd09f60e49958957d55606c9..df055ae79c6e93f7d4035cc9c0500375501a6694 100644
--- a/src/graph_tool/inference/partition_modes.py
+++ b/src/graph_tool/inference/partition_modes.py
@@ -18,8 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView, _get_rng, Vector_int32_t, \
- Vector_size_t
+from .. import Graph, _get_rng, Vector_int32_t, Vector_size_t
from . blockmodel import DictState, get_entropy_args, _bm_test
from .. dl_import import dl_import
@@ -370,4 +369,4 @@ def overlap_center(bs, init=None):
nr = np.bincount(bs[:,i])
c[i] = nr.argmax()
delta = 1 - partition_overlap(c, lc)
- return c
\ No newline at end of file
+ return c
diff --git a/src/graph_tool/inference/uncertain_blockmodel.py b/src/graph_tool/inference/uncertain_blockmodel.py
index 4e6b15545d74d093a5650ad411f9daef2cba91b4..8363595e2745a29dd03f555da8034dc4b73371db 100644
--- a/src/graph_tool/inference/uncertain_blockmodel.py
+++ b/src/graph_tool/inference/uncertain_blockmodel.py
@@ -18,8 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from .. import _degree, _prop, Graph, GraphView, libcore, _get_rng, \
- PropertyMap, edge_endpoint_property
+from .. import _prop, Graph, GraphView, _get_rng, PropertyMap, \
+ edge_endpoint_property
from .. dl_import import dl_import
dl_import("from . import libgraph_tool_inference as libinference")
diff --git a/src/graph_tool/search/__init__.py b/src/graph_tool/search/__init__.py
index caee899e79d39491fc2a65be0d3a65bae47c4ad8..1ddb25a5e65ed58923d9badf947cf105067482de 100644
--- a/src/graph_tool/search/__init__.py
+++ b/src/graph_tool/search/__init__.py
@@ -81,7 +81,6 @@ from .. dl_import import dl_import
dl_import("from . import libgraph_tool_search")
from .. import _prop, _python_type, _get_null_vertex
-import weakref
import numpy
__all__ = ["bfs_search", "bfs_iterator", "BFSVisitor", "dfs_search",
diff --git a/src/graph_tool/stats/__init__.py b/src/graph_tool/stats/__init__.py
index 94ab62aa54b89a50d602b08d2fe0a121cd7d278c..27c31299d5d283c2620c4ccb31cfb3b23dad02d5 100644
--- a/src/graph_tool/stats/__init__.py
+++ b/src/graph_tool/stats/__init__.py
@@ -49,7 +49,6 @@ dl_import("from . import libgraph_tool_stats")
from .. import _degree, _prop, _get_rng, GraphView, PropertyMap
from numpy import *
-import numpy
__all__ = ["vertex_hist", "edge_hist", "vertex_average", "edge_average",
"label_parallel_edges", "remove_parallel_edges",
diff --git a/src/graph_tool/topology/__init__.py b/src/graph_tool/topology/__init__.py
index d232a05accdf0d0d0284b1c69437709dc4538a27..2e2862f1b6fac7660972e012e5de788e9dbe422a 100644
--- a/src/graph_tool/topology/__init__.py
+++ b/src/graph_tool/topology/__init__.py
@@ -76,10 +76,9 @@ dl_import("from . import libgraph_tool_topology")
from .. import _prop, Vector_int32_t, Vector_size_t, _check_prop_writable, \
_check_prop_scalar, _check_prop_vector, Graph, VertexPropertyMap, \
- EdgePropertyMap, PropertyMap, GraphView, libcore, _get_rng, _degree, \
- perfect_prop_hash, _limit_args
+ PropertyMap, GraphView, libcore, _get_rng, perfect_prop_hash, _limit_args
from .. stats import label_self_loops
-import random, numpy, collections
+import numpy, collections
__all__ = ["isomorphism", "subgraph_isomorphism", "mark_subgraph",
"max_cliques", "max_cardinality_matching",