Skip to content

c-blake/gralg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a small collection of classical graph algorithms on digraphs in Nim.

The core abstractions representing a graph are some kind of not necessarily dense integer-like address space, some nodes iterator on the graph and some edges(graph, node) iterator on the kids of a node/destinations of arcs.

It also contains (also at the top level) gaPrioQ.nim since the shortest path algorithm made famous by Dijkstra needs a priority queue that can efficiently edit entry priorities and std/heapqueue does not allow this.

https://github.com/c-blake/thes has demos/tests of most of these algorithms, but a quick list is:

  • arc/edge reversal
  • topological sorting/testing for DAG/cyclicity
  • transitive closure
  • shortest path from beginning to end via BFS
  • shortest path from beginning to end via Dijkstra
  • components when viewed as an undirected graph
  • min cost spanning tree of weighted, undirected graph

Should probably grow Max Flow, and weak strong components algorithms.