I am yet to dive in WPP but I want to help you live a For
-free life :) hope you don't mind. Those are nothing but side notes.
a) Since matr
is a sparse binary array you can do:
hyperlist = matr["NonzeroPositions"]
And if it weren't sparse and binary you could use Position[matr, 1]
. For sparse non binary: Position[ Normal @ matr, 1]
b)
shortestmaxradius = assoc // Map[Length] // Min
c) Dataplot, not exactly shorter but more idiomatic:
Dataplot = assoc[[All, 2 ;; shortestmaxradius]] // Values //
MapIndexed[{#2[[2]], #} &, #, {2}] & //
Apply[Join] //
Prepend[{0, 0}]
Notice those lines lack of assoc
length, 10
, which was hardcoded.
d) Don't use sym := something
unless you know you need :=
, =
is enough. If something
is time intensive and sym
is called multiple times this can make a difference.
Again, nothing but side notes. Good luck.