mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.5 KiB
1.5 KiB
obigraph.GraphBuffer Feature Overview
The GraphBuffer[V, T] type provides a thread-safe graph construction interface using buffered edge insertion via Go channels.
- Asynchronous Edge Addition: Edges are enqueued through a
chan Edge[T], processed in the background by a goroutine that updates an underlying static graph (Graph[V, T]). - Non-blocking API:
AddEdgeandAddDirectedEdgeare non-synchronous — they send to the channel without waiting for graph mutation, enabling high-throughput edge ingestion. - Graph Initialization:
NewGraphBufferinitializes both the graph and a dedicated worker goroutine to consume edges. - GML Export Support: Full support for exporting the final graph in Graph Modelling Language (GML), with optional filtering (
min_degree) and layout parameters (threshold,scale). - File & Stream Output: Methods
WriteGmlandWriteGmlFileallow writing GML to anyio.Writer, including files. - Resource Cleanup: The explicit
Close()method terminates the worker goroutine by closing the channel, ensuring clean shutdown. - Generic Design: Fully generic over vertex (
V) and edge data types (T), supporting arbitrary value semantics.
⚠️ Note: The buffer is not safe for concurrent
AddEdgecalls without external synchronization beyond channel semantics.
✅ Ideal for producer-consumer patterns where edges are streamed from multiple goroutines into a single graph.