Repository navigation
Commit caec1ab
feat: coordinates(), build_kdtree(), subgraph mask, validate coordinates
coordinates() is the matrix of vertex coordinates, one column per vertex in
insertion order (NaN for a vertex with none), a view of a row-per-vertex array.
within() and near() are now computed on it with numpy, for the built-in
metrics, instead of vertex by vertex.
build_kdtree() builds an optional scipy cKDTree that closest() and near()
use for the built-in L1, L2 and SE2 (with its weight, using a periodic
dimension for the angle). scipy is imported only inside the method and is
not added to pyproject.toml. The index is dropped when a vertex is added or
removed or a coord is assigned (Vertex.__setattr__), so a stale index is never
used; a coordinate edited in place is documented as not seen. It is not
copied or pickled.
subgraph() also takes a boolean mask of length n. An integer vector is
refused, since it could be indices.
validate() now checks that coordinates are finite 1-D numeric vectors and,
when dim was not given, all of one length, and with embedded=True that every
vertex has one.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>1 parent 78ffdb7 commit caec1ab
4 files changed
Lines changed: 777 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| 69 | + | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| 73 | + | |
65 | 74 | | |
66 | 75 | | |
67 | 76 | | |
| |||
163 | 172 | | |
164 | 173 | | |
165 | 174 | | |
| 175 | + | |
166 | 176 | | |
167 | 177 | | |
168 | 178 | | |
| 179 | + | |
169 | 180 | | |
170 | 181 | | |
171 | 182 | | |
| |||
0 commit comments