Commit Graph

171 Commits

Author SHA1 Message Date
Dan Kortschak
c64a0a7fc7 graph/encoding/dot: run go fmt -s 2018-12-12 21:38:20 +10:30
Dan Kortschak
4fc8509578 encoding/dot: pass returned error up call stack
This should probably use a rich error strategy, but we can leave that for
when the Go error handling experiments are more fully developed.
2018-11-25 18:52:21 +10:30
Dan Kortschak
cdf8233f4e encoding/dot: always allow first graph to be returned 2018-11-25 18:52:21 +10:30
J. Holmes
b3c4e40467 graph/encoding/dot: add multigraph serialization and deserialization support 2018-11-25 07:31:56 +10:30
Dan Kortschak
2b0dcc4a5e graph/multi: test graph implementations with testgraph package
Fix bugs found by testgraph.
2018-11-21 11:35:03 +10:30
Dan Kortschak
2df0688894 graph/simple: test graph implementations with testgraph package
Fix bugs found by testgraph.
2018-11-21 11:35:03 +10:30
Dan Kortschak
a8f1562992 graph/testgraph: new package for testing graph implementations
Currently variant line types do not work the same way as they would with
a slice of edges because access to a []graph.Edge also allows the
elements of that slice can be type asserted to richer types like
graph.Line or graph.WeightedEdge for example. This cannot be done with
the API as is stands with the iterator-holding edge being down graded
from one of the richer types.
The problem can be avoided by either making graph.WeightedLines also
satisfy graph.Lines (same for edges), or by down-typing the edges in the
non-weighted edge return methods for the graph implemetations.
2018-11-21 11:35:03 +10:30
Dan Kortschak
5b0db962f3 graph/path: make AllShortest safe for length zero 2018-11-21 07:57:39 +10:30
Olivier Wulveryck
d41320af1e fix: documentation of Marshal
the "strict" keyword mentioned in the documentation does not exist
anymore
2018-11-20 07:15:39 +10:30
Dan Kortschak
48288cca5b graph/{multi,simple}: harmonise code order
Previously there was an attempt to maintain some kind of semantic ordering,
but given the needed complexity of the API this has become untenable. So
just order according to the Godoc — alphabetical for exported methods and
functions. For unexported functions, use judgement.

One method, Has on multi.DirectedGraph, that should not have been present is
deleted.
2018-11-08 07:11:52 +10:30
Dan Kortschak
609b9d63e8 encoding/dot: make all simple graph marshalling strict
Also fix bug in order of emitting strict keyword.
2018-10-29 23:16:49 +10:30
Dan Kortschak
3f739e94a4 graph: make slicer helpers return nil for zero length
Also fix up var names.
2018-10-27 16:51:46 +10:30
Dan Kortschak
45a3ddb340 cytoscapejs: fix optional field marshaling and helper type naming 2018-10-26 23:42:21 +10:30
Dan Kortschak
61e3cd1956 graph/graphs/gen: simplify interface requirements 2018-10-26 21:38:32 +10:30
Dan Kortschak
f021a2e7da graph/graphs/gen: make NavigableSmallWorld use dst's edge and node constructors
This changes the behaviour of the function to create the small world graph as
a disconnected subgraph in g rather than applying the algorithm to potentially
already existing nodes in g.
2018-10-26 21:38:32 +10:30
Dan Kortschak
75ba0793c2 graph/graphs/gen: make SmallWorldsBB use dst's edge and node constructors
This changes the behaviour of the function to create the small world graph as
a disconnected subgraph in g rather than applying the algorithm to potentially
already existing nodes in g.
2018-10-26 21:38:32 +10:30
Dan Kortschak
bcbfcb9c4e graph/graphs/gen: make Gnp and Gnm use dst's edge and node constructors
This changes the behaviour of the function to create the Gnm and Gnp graphs as
disconnected subgraphs in g rather than applying the algorithm to potentially
already existing nodes in g.
2018-10-26 21:38:32 +10:30
Dan Kortschak
bf5843c295 graph/graphs/gen: make TunableClusteringScaleFree use dst's edge and node constructors
This changes the behaviour of the function to create the scale free graph as
a disconnected subgraph in g rather than applying the algorithm to potentially
already existing nodes in g.
2018-10-26 21:38:32 +10:30
Dan Kortschak
d48461cca9 graph/graphs/gen: fix node presence test in TunableClusteringScaleFree 2018-10-26 21:38:32 +10:30
Dan Kortschak
f0982070f5 graph/formats: add packages for serialising graphs to js rendering engines 2018-10-20 06:39:27 +10:30
Dan Kortschak
056846ef7e gexf12: make slice fields plural and break words apart 2018-10-13 18:53:13 +10:30
Dan Kortschak
406984d374 gexf12: do not use pointers on simple types 2018-10-13 06:13:25 +10:30
Dan Kortschak
59eac3d17e gexf12: fix omitable and unbounded attributes 2018-10-13 06:13:25 +10:30
Dan Kortschak
de98af5d4b graph/multi: clean up missed changes and bugs 2018-10-12 20:36:12 +10:30
Dan Kortschak
969ecdd209 graph: remove Has method from Graph and Multigraph 2018-10-12 17:57:01 +10:30
Dan Kortschak
f48f3e4ab3 graph/formats/gexf12: new package for handling GEXF1.2 graph description files
This was largely written by aqwari.net/xml/cmd/xsdgen working on the XSD
files available from the gephy/gexf specs repository[1], with some help;
the specs use includes which cause xsdgen to fail, so I manually
in-lined the includes.

The generated code was then edited to make optional attributes exist on
pointers, to reduce the length of labels to within reasonably normal Go
idiom and removing unnecessary namespacing.

The package is versioned since the format appears to arbitrarily be
updated.

[1]81ba4e7ccd/specs/1.2draft
2018-10-11 16:48:29 +10:30
Olivier Wulveryck
a290f01ec4 graph/encoding/dot: fix link to dot documentation
Add Olivier Wulveryck to A+C
2018-10-01 19:22:03 +09:30
Dan Kortschak
72b16051b3 graph: fix doc for Undirect*.Node 2018-09-29 22:38:50 +09:30
Dan Kortschak
46d85b5bdf graph: avoid issues around graph node retrieval subtleties
With the approach to graph node mutation on edge setting the previously
existed there was an issue that the edge last used connect a pair of
nodes could result in a difference in the nodes being returned by a node
query compared to the same node associated with edges returned from an
edge query.

This change avoids dealing with that by making it implementation
dependent and stating this, and by making all the node-storing graphs
we provide mutate the nodes when edges are set.
2018-09-29 19:26:44 +09:30
Dan Kortschak
72366fbe54 graph/{multi,simple}: ensure implementations satisfy the interfaces they target 2018-09-23 19:12:43 +09:30
Dan Kortschak
b73a2c92ff graph: add node, edge and line iterators 2018-09-23 09:25:56 +09:30
Dan Kortschak
36be7e6faa travis: check for copyright headers 2018-09-05 16:54:43 +09:30
Dan Kortschak
70492dcef1 all: quieten vet for unkeyed composite literals in test code 2018-09-02 07:59:12 +09:30
Dan Kortschak
0d92706921 graph/path: add Yen k-shortest paths implementation
Also add Rishi Desai, primary-author of the commit.
2018-08-22 07:50:28 +09:30
Dan Kortschak
72e79ca985 all: add safe synonym for appengine tag 2018-07-22 17:17:15 +09:30
Dan Kortschak
259c560b35 graph/encoding/dot: add test for chained edge attributes 2018-07-16 11:50:45 +09:30
mewmew
d75fc496fb graph/encoding/dot: add attributes for edge chains
Fixes #545.
2018-07-16 08:27:13 +09:30
Dan Kortschak
b9db25a610 all: conform build tag comment to convention 2018-07-06 09:05:06 +09:30
Vladimir Chalupecky
b96df58db9 all: add missing copyright headers 2018-06-22 17:32:53 +02:00
Takeshi Yoneda
d05be515f6 network: add edge-weighted PageRank implementations 2018-06-10 17:27:38 +09:30
Dan Kortschak
a63e6adee3 graph/path/internal: move grid graphs into testgraphs 2018-06-07 19:37:48 +09:30
Dan Kortschak
9b6dcf36f0 all: fix up missing or malformatted package doc comments 2018-06-07 19:37:48 +09:30
Dan Kortschak
438fe0c5f4 encoding/dot: run gofmt 2018-06-07 17:58:20 +09:30
Egon Elbre
51a14e5e72 graph/formats/dot: allow unicode inside html 2018-06-03 22:10:54 +09:30
Dan Kortschak
f5d91d72f8 graph/path: allow incremental path building for Dijkstra 2018-05-24 07:13:55 +09:30
Dan Kortschak
fa6741ae52 graph/path: tighten use of johnsonWeightAdjuster
The only call to Has for johnsonWeightAdjuster is in the preamble to
BellmanFordFor, which is always passed the known query node. If Has is
called when the graph is not in the Bellman-Ford mode or the Has query
is not the query node, the call was invalid and we should panic.
2018-05-09 22:09:45 +09:30
Dan Kortschak
22552cc6f1 traverse: relax requirements for traversal types
This is special cased because simple graph traversal is generally useful
and users my want to be able to travers graph-like types without
implementing all the methods on graph.Graph.
2018-05-09 07:30:30 +09:30
Dan Kortschak
32a6369498 graph: use int64 for edge and line removal 2018-05-07 19:11:10 +09:30
Dan Kortschak
a1b5d898fe graph: use int64 for node removal 2018-05-07 19:11:10 +09:30
Dan Kortschak
4eed5b6553 all: replace publicly facing *rand.Rand with rand.Source 2018-05-03 07:40:18 +09:30