A Go library for creating and manipulating graph data structures.
This Go-based graph library is designed for versatility, performance, and extensibility, leveraging generics to handle various graph-related operations seamlessly. Key features include:
- Generics-Based Design: Leverages Go generics for a flexible and type-safe graph interface supporting custom vertex and edge types.
- Trait-Driven Configuration: Supports traits such as directed/undirected, weighted, acyclic, rooted, and multigraph properties.
- Comprehensive Graph Operations: Provides efficient algorithms for CRUD operations, set operations, adjacency/predecessor maps, and graph cloning.
- Traversal and Pathfinding: Implements breadth-first, depth-first, and shortest-path algorithms. Supports minimum and maximum spanning tree computation.
- Graph Metrics: Offers centrality measures (degree, closeness, betweenness, eigenvector), clustering coefficients, density, diameter, and average path length.
- Community and Ranking Analysis: Includes modularity and PageRank calculations for advanced graph analysis.
- Cycle Management: Prevents cycles in acyclic graphs during edge additions.
- Streaming Support: Enables paginated streaming of vertices and edges with context management for cancellation and resumption.
- Customizable Input/Output: Supports flexible graph serialization and custom reader/writer implementations.
- Concurrency Safe: Designed for thread-safe operations in multi-threaded environments.
- Lightweight and Efficient: Optimized for high performance with minimal overhead.
- Zero Dependencies: Lightweight implementation with no external dependencies beyond the standard library.
- Supports
io.Reader
Interface:- Graph Serialization: Export and import graphs to/from various formats for interoperability.
- Customizable Readers and Writers: Create tailored I/O operations for graph persistence.
To install this package, run the following command:
go get -u github.com/sixafter/graph
To use the package in your Go project, import it as follows:
import "github.com/sixafter/graph"
Contributions are welcome. See CONTRIBUTING
This project is licensed under the Apache 2.0 License. See LICENSE file.