Debian Codegraph @

README.md

raw symbols SCIP
1 # Your basic graph [![GoDoc](https://godoc.org/github.com/yourbasic/graph?status.svg)][godoc-graph]
2
3 ### Golang library of basic graph algorithms
4
5 ![Topological ordering](top.png)
6
7 *Topological ordering, image by [David Eppstein][de], [CC0 1.0][cc010].*
8
9 This library offers efficient and well-tested algorithms for
10
11 - breadth-first and depth-first search,
12 - topological ordering,
13 - strongly and weakly connected components,
14 - bipartion,
15 - shortest paths,
16 - maximum flow,
17 - Euler walks,
18 - and minimum spanning trees.
19
20 The algorithms can be applied to any graph data structure implementing
21 the two `Iterator` methods: `Order`, which returns the number of vertices,
22 and `Visit`, which iterates over the neighbors of a vertex.
23
24 All algorithms operate on directed graphs with a fixed number
25 of vertices, labeled from 0 to n-1, and edges with integer cost.
26 An undirected edge {v, w} of cost c is represented by the two
27 directed edges (v, w) and (w, v), both of cost c.
28 A self-loop, an edge connecting a vertex to itself,
29 is both directed and undirected.
30
31
32 ### Graph data structures
33
34 The type `Mutable` represents a directed graph with a fixed number
35 of vertices and weighted edges that can be added or removed.
36 The implementation uses hash maps to associate each vertex
37 in the graph with its adjacent vertices. This gives constant
38 time performance for all basic operations.
39
40 The type `Immutable` is a compact representation of an immutable graph.
41 The implementation uses lists to associate each vertex in the graph
42 with its adjacent vertices. This makes for fast and predictable
43 iteration: the Visit method produces its elements by reading
44 from a fixed sorted precomputed list.
45
46
47 ### Virtual graphs
48
49 The subpackage `graph/build` offers a tool for building graphs of type `Virtual`.
50
51 In a virtual graph no vertices or edges are stored in memory,
52 they are instead computed as needed. New virtual graphs are constructed
53 by composing and filtering a set of standard graphs, or by writing
54 functions that describe the edges of a graph.
55
56 The following standard graphs are predefined:
57
58 - empty graphs,
59 - complete graphs and complete bipartite graphs,
60 - grid graphs and complete *k*-ary trees,
61 - cycle graphs and circulant graphs,
62 - and hypergraphs.
63
64 The following operations are supported:
65
66 - adding and deleting sets of edges,
67 - adding cost functions,
68 - filtering graphs by edge functions,
69 - complement, intersection and union,
70 - subgraphs,
71 - connecting graphs at a single vertex,
72 - joining two graphs by a set of edges,
73 - matching two graphs by a set of edges,
74 - cartesian product and tensor product.
75
76 Non-virtual graphs can be imported, and used as building blocks,
77 by the `Specific` function. Virtual graphs don't need to be “exported‬”;
78 they implement the `Iterator` interface and hence can be used directly
79 by any algorithm in the graph package.
80
81
82 ### Installation
83
84 Once you have [installed Go][golang-install], run this command
85 to install the `graph` package:
86
87 go get github.com/yourbasic/graph
88
89
90 ### Documentation
91
92 There is an online reference for the package at
93 [godoc.org/github.com/yourbasic/graph][godoc-graph].
94
95
96 ### Roadmap
97
98 * The API of this library is frozen.
99 * Bug fixes and performance enhancement can be expected.
100 * New functionality might be included.
101 * Version numbers adhere to [semantic versioning][sv].
102
103 The only accepted reason to modify the API of this package is to
104 handle issues that can't be resolved in any other reasonable way.
105
106 New features and performance enhancements are limited to basic
107 algorithms and data structures, akin to the ones that you might find
108 in a computer science textbook.
109
110 Stefan Nilsson – [korthaj](https://github.com/korthaj)
111
112 [godoc-graph]: https://godoc.org/github.com/yourbasic/graph
113 [golang-install]: http://golang.org/doc/install.html
114 [cc010]: https://creativecommons.org/publicdomain/zero/1.0/deed.en
115 [de]: https://commons.wikimedia.org/wiki/User:David_Eppstein
116 [sv]: http://semver.org/
117