From bfba6608339c6f2831977263b0e7167e3cc6079e Mon Sep 17 00:00:00 2001 From: Tiago de Paula Peixoto Date: Tue, 4 Jun 2019 23:45:16 +0100 Subject: [PATCH] scalar_assortativity(): Raise exception for non-scalar properties --- src/graph_tool/correlations/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/graph_tool/correlations/__init__.py b/src/graph_tool/correlations/__init__.py index a3248bdd..aeb65330 100644 --- a/src/graph_tool/correlations/__init__.py +++ b/src/graph_tool/correlations/__init__.py @@ -44,7 +44,7 @@ from __future__ import division, absolute_import, print_function from .. dl_import import dl_import dl_import("from . import libgraph_tool_correlations") -from .. import _degree, _prop +from .. import _degree, _prop, _check_prop_scalar, VertexPropertyMap from numpy import * __all__ = ["assortativity", "scalar_assortativity", "corr_hist", @@ -182,6 +182,8 @@ def scalar_assortativity(g, deg, eweight=None): Phys. Rev. E 67, 026126 (2003), :doi:`10.1103/PhysRevE.67.026126` .. _jackknife method: http://en.wikipedia.org/wiki/Resampling_%28statistics%29#Jackknife """ + if isinstance(deg, VertexPropertyMap): + _check_prop_scalar(deg, name="deg") return libgraph_tool_correlations.\ scalar_assortativity_coefficient(g._Graph__graph, _degree(g, deg), _prop("e", g, eweight)) -- GitLab