|
| 1 | +# Your basic graph |
| 2 | + |
| 3 | +Golang library of basic graph algorithms |
| 4 | + |
| 5 | +### Generic graph algorithms |
| 6 | + |
| 7 | +The algorithms can be applied to any graph data structure implementing |
| 8 | +the two Iterator methods: Order, which returns the number of vertices, |
| 9 | +and Visit, which iterates over the neighbors of a vertex. |
| 10 | + |
| 11 | +All algorithms operate on directed graphs with a fixed number |
| 12 | +of vertices, labeled from 0 to n-1, and edges with integer cost. |
| 13 | +An undirected edge {v, w} of cost c is represented by the two |
| 14 | +directed edges (v, w) and (w, v), both of cost c. |
| 15 | +A self-loop, an edge connecting a vertex to itself, |
| 16 | +is both directed and undirected. |
| 17 | + |
| 18 | +### Graph data structures |
| 19 | + |
| 20 | +The type Mutable represents a directed graph with a fixed number |
| 21 | +of vertices and weighted edges that can be added or removed. |
| 22 | +The implementation uses hash maps to associate each vertex |
| 23 | +in the graph with its adjacent vertices. This gives constant |
| 24 | +time performance for all basic operations. |
| 25 | + |
| 26 | +The type Immutable is a compact representation of an immutable graph. |
| 27 | +The implementation uses lists to associate each vertex in the graph |
| 28 | +with its adjacent vertices. This makes for fast and predictable |
| 29 | +iteration: the Visit method produces its elements by reading |
| 30 | +from a fixed sorted precomputed list. This type supports multigraphs. |
| 31 | + |
| 32 | +### Virtual graphs |
| 33 | + |
| 34 | +The subpackage graph/build offers a tool for building virtual graphs. |
| 35 | +In a virtual graph no vertices or edges are stored in memory, |
| 36 | +they are instead computed as needed. New virtual graphs are constructed |
| 37 | +by composing and filtering a set of standard graphs, or by writing |
| 38 | +functions that describe the edges of a graph. |
| 39 | + |
| 40 | +### Author |
| 41 | + |
| 42 | +Stefan Nilsson – [korthaj](https://github.com/korthaj) |
| 43 | + |
| 44 | +### License |
| 45 | + |
| 46 | +This project is licensed under the 2-Clause BSD License – |
| 47 | +see the [LICENSE](LICENSE) file for details. |
0 commit comments