Algorithms that require graphs are very common. This is a generic graph library that enables many useful features with its core design philosophy to be functional.
.
├── cmd
│ └── graph
│ └── main.go
├── go.mod
├── go.sum
├── graph_gui.go
├── graph_test.go
├── graph.go
└── README.md
3 directories, 7 filesThe goal of this library is to create a generic graph API with a bunch of useful (and commonly) needed functionalities these include
DFSDepth First Search, enables traversing the graph in a DFS manner.BFSBreadth First Search, enables traversing the graph in a BFS manner.MapMapGraph, enables mapping/translating a graph of typeXto a graph of typeY.FilterFilterGraph, enables filtering of edges on this graph by a specific predicate.Cycle DetectionContainsCycle determines if a graph contains a cycle.
Every single method and function available in graph is pure and functional. Meaning that the resulting method
application does not change the underlying graph, instead it returns a new graph underneath. HOWEVER, this does not
gurantee that mutable data types will not be cloned.
Under the hood, graph uses Gio to render graph GUIs. If you wish to use the GUI methods available please install
go install gioui.org/cmd/gogio@latest