File tree 2 files changed +7
-6
lines changed
graphblas_algorithms/algorithms
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change
1
+ from graphblas import binary
2
+
1
3
__all__ = ["s_metric" ]
2
4
3
5
@@ -6,7 +8,7 @@ def s_metric(G):
6
8
degrees = G .get_property ("total_degrees+" )
7
9
else :
8
10
degrees = G .get_property ("degrees+" )
11
+ return (binary .first (degrees & G ._A ) @ degrees ).reduce ().get (0 ) / 2
9
12
# Alternatives
10
13
# return (degrees @ binary.second(G._A & degrees)).reduce().get(0) / 2
11
- # return (binary.first(degrees & G._A) @ degrees).reduce().get(0) / 2
12
- return degrees .outer (degrees ).new (mask = G ._A .S ).reduce_scalar ().get (0 ) / 2
14
+ # return degrees.outer(degrees).new(mask=G._A.S).reduce_scalar().get(0) / 2
Original file line number Diff line number Diff line change @@ -9,10 +9,9 @@ exclude =
9
9
graphblas_algorithms/*/tests/,
10
10
graphblas_algorithms/*/*/tests/,
11
11
build/
12
- ignore =
13
- E203, # whitespace before ':'
14
- E231, # Multiple spaces around " ,"
15
- W503, # line break before binary operator
12
+ extend-ignore =
13
+ E203,
14
+ # E203 whitespace before ':' (to be compatible with black)
16
15
per-file-ignores =
17
16
__init__.py:F401,F403, # allow unused and star imports
18
17
test_*.py:F401,F403,
You can’t perform that action at this time.
0 commit comments