Commit Graph

277 Commits

Author SHA1 Message Date
Dan Kortschak
0e6fb8d22a all: use scalar.Same instead of local same function 2020-08-07 07:59:02 +09:30
Dan Kortschak
da72779e7a floats/scalar: new package containing non-vector functions from floats 2020-08-07 07:59:02 +09:30
Sebastien Binet
66aa83975b all: put examples into a xxx_test package clause
Fixes gonum/gonum#1395.
2020-07-13 12:01:16 +02:00
Dan Kortschak
27220e4f5c graph/path: add missing doc comment 2020-07-12 18:07:51 +09:30
Dan Kortschak
6a06a241d1 graph/path: use a struct to make intentions in negative edges clearer 2020-07-12 18:07:51 +09:30
Dan Kortschak
0631cb635a graph/path: improve negative costs accounting field documentation 2020-07-12 07:26:07 +09:30
Dan Kortschak
04e487c6bc graph/path: add doc comments for unexported path construction methods 2020-07-12 07:26:07 +09:30
Dan Kortschak
9ae0689dae graph/path: add option to retain all paths from single-source path finding routines 2020-07-10 07:22:35 +09:30
Dan Kortschak
3bedd58622 graph/path: properly report negative cycles in Shortest.To
We still use the maxEdges condition to allow a better exploration of the graph
before terminating.
2020-07-07 06:20:59 +09:30
Dan Kortschak
42752487ce graph/path/dynamic: remove unnecessary nolint comment
The golangci-lint staticcheck version has been updated and now correctly runs the
SA4000 lint check on arrays of float.
2020-07-06 20:16:57 +09:30
Dan Kortschak
2241fbf495 graph/path/internal: add more negative cycle cases 2020-07-03 06:38:13 +09:30
Dan Kortschak
8d4cfcdeb8 graph/path: fix error messages 2020-07-02 15:56:32 +09:30
Dan Kortschak
18a9c3eabc graph/path: fix comments in BellmanFordFrom 2020-07-02 12:12:34 +09:30
Dan Kortschak
142f1a8c6b graph: make graph analysis routines safe for indeterminate iterators
This is a change in design for the graph.NodesOf family of functions. The
alternative was to provide an equivalent set of non-panicking routines in
graph for internal use. The protection that was intended with the panic
was to panic early rather than late when an indeterminate iterator exhausts
slice index space. I think in hindsight this was an error and we should
let things blow up in that (likely rare) situation.

The majority of changes are in test code. Outside the iterator package, which
is intimately tied to the determined iterator implementations, only one test
now fails if an indeterminate iterator is used, product's Modular extended
sub-graph isomorphism example, which is an algorithm that would have time
complexity issues with large iterators anyway.
2020-07-02 07:47:46 +09:30
Dan Kortschak
39cd12e938 graph/iterator: add lazy ordered node iterators 2020-07-02 07:47:46 +09:30
Dan Kortschak
2db33926ac graph/iterator: extend iteration tests and fix counting error 2020-07-02 07:47:46 +09:30
Dan Kortschak
16da37cc66 graph/iterator: implement unsafe node iterators 2020-07-02 07:47:46 +09:30
Dan Kortschak
2bf857dc70 graph: use iterators directly rather than copying into []graph.Node
There are still uses in test code; these can remain since they simplify
that code.
2020-07-02 07:47:46 +09:30
Dan Kortschak
91d83a4f35 graph/iterator: add fast paths for node slices and add tests
Fix bugs in NodeSlice methods:

- ImplicitNodes did not return nil for an empty set of nodes.
- OrderedNodes returned one too many nodes if Next has been called.
2020-07-02 07:47:46 +09:30
Dan Kortschak
0fd78a9919 graph: fix nodeIteratorPair bug revealed by lazy iterators 2020-07-02 07:47:46 +09:30
Dan Kortschak
a961bdeed7 graph/multi: use lazy edge-based node iterator for From, To and Nodes methods 2020-07-02 07:47:46 +09:30
Dan Kortschak
f0f9a9eaf8 graph/simple: use lazy edge-based node iterator for From, To and Nodes methods 2020-07-02 07:47:46 +09:30
Dan Kortschak
d4ef54c821 graph/iterator: implement edge and line based lazy node iterator 2020-07-02 07:47:46 +09:30
Dan Kortschak
8331aaab06 graph/path: fix documentation on Shortest 2020-06-14 17:45:15 +09:30
Dan Kortschak
72a397e184 graph/path: reduce indexing into next in Shortest.To 2020-06-14 17:45:15 +09:30
Dan Kortschak
f5dc855938 graph/flow: avoid non-rune to string conversion 2020-05-17 14:56:55 +09:30
Egon Elbre
63537531dd graph/path: generate benchmark data on-demand 2020-03-16 16:10:59 +02:00
Egon Elbre
b6ceadb9b7 graph/path: make tests parallel 2020-03-16 16:10:59 +02:00
Egon Elbre
290d48f07b graph/graphs/gen: make tests parallel 2020-03-16 16:10:59 +02:00
Dan Kortschak
d8ec179f2b graph/layout: differentiate arm64 layout golden images 2020-01-13 08:52:57 +10:30
Dan Kortschak
b5cc9a9859 graph/layout: avoid panic in Eades test on arm64 2020-01-13 08:52:57 +10:30
Dan Kortschak
c5919b2e44 graph/path: make sure absent nodes are returned with the correct ID 2019-12-05 23:30:55 +10:30
Dan Kortschak
c4b2949c58 graph/encoding/dot: add example for decoding a weighted graph 2019-11-30 05:40:37 +10:30
Dan Kortschak
e532b71013 graph/{multi,simple}: don't return pointer values from NewEdge/NewLine 2019-11-28 21:55:09 +10:30
Dan Kortschak
b34a300801 all: fix capitalisation of Gonum
This fixes the capitalisation of Gonum where it refers to the project rather
than the GitHub organisation or repository. The text of CONTRIBUTORS also
is fixed to reflect the reality that contributors may have contributed to
other repositories within the project.
2019-11-16 21:25:28 +10:30
Dan Kortschak
90165046ad graph/product: add extended modular product function 2019-11-08 13:14:39 +10:30
Dan Kortschak
48da12cd27 spectral: new package for spectral graph analysis
Initial commit to this is just a move of the Laplacian type from network.
2019-11-08 06:52:57 +10:30
Dan Kortschak
623f346311 graph: clean up lint 2019-11-02 05:20:20 +10:30
Dan Kortschak
96934bab56 graph: add implicit graph complement type 2019-10-30 09:26:19 +10:30
Dan Kortschak
7b679e3cd8 graph: rename nodeFilterIterator => nodeIteratorPair and minor fixes
The length calculation is now correct. This had not effect previously as
NodesOf is lenient in how it handles mis-estimated iterator lengths.
2019-10-30 09:26:19 +10:30
Dan Kortschak
bfd8b33ce7 graph/product: fix subtle interaction between dst and inputs
The optimisation that is applied for undirected graphs is only valid if
the destination graph is also undirected. So we need to check that and only
apply the optimisation when all three graphs are undirected.
2019-10-30 06:34:53 +10:30
Dan Kortschak
b76c2d70ce graph/product: improve documentation 2019-10-30 06:34:53 +10:30
Dan Kortschak
91be6d11ab graph/product: new package for constructing graph products 2019-10-29 11:03:26 +10:30
Dan Kortschak
7fab5d5616 graph/community: remove lint 2019-10-28 14:23:17 +10:30
Dan Kortschak
3dd2e36417 graph/topo: add Equal test for graph topology equality comparison 2019-10-28 13:36:12 +10:30
Dan Kortschak
1459092b91 graph/encoding/dot: remove linty cruft 2019-10-14 05:57:25 +10:30
Dan Kortschak
f714310635 graph/path: add nodes to shortest path tree lazily 2019-10-13 19:24:12 +10:30
Dan Kortschak
2a132c9421 graph/iterator: consolidate node iterators 2019-10-13 07:56:07 +10:30
Dan Kortschak
efaa498867 dynamic: clarify use of inequality with float-based keys 2019-10-12 23:56:31 +10:30
Brendan Tracey
5d5638e674 stat/*: Update functions to take empty matrices (#1102)
* stat/*: Update functions to take empty matrices

Change TorgersonScaling to require an empty matrix. Users who want to reuse data can call Reset now that it is exposed. This function is different than others because the return size is unknown. Forcing the input matrix to be empty makes it clear that the dst matrix will be dynamically resized

Fixes #1081.
2019-10-09 23:20:26 +01:00