github.com/dominikbraun/graph (go): Package graph is a library for creating generic graph data structures and modifying, analyzing, and visualizing them.  A graph consists of vertices of type T, which are identified by a hash value of type K. The hash value for a given vertex is obtained using the hashing function passed to New. A hashing function takes a T and returns a K.  For primitive types like integers, you may use a predefined hashing function such as IntHash – a function that takes an integer and uses that integer as the hash value at the same time:  For storing custom data types, you need to provide your own hashing function. This example takes a City instance and returns its name as the hash value:  Creating a graph using this hashing function will yield a graph of vertices of type City identified by hash values of type string.  Adding vertices to a graph of integers is simple. graph.Graph.AddVertex takes a vertex and adds it to the graph.  Most functions accept and return only hash values instead of entire instances of the vertex type T. For example, graph.Graph.AddEdge creates an edge between two vertices and accepts the hash values of those vertices. Because this graph uses the IntHash hashing function, the vertex values and hash values are the same.  All operations that modify the graph itself are methods of Graph. All other operations are top-level functions of by this library.  For detailed usage examples, take a look at the README.
Keywords: algorithm|graph|graph-algorithms|graph-theory|graph-traversal|graph-visualization