Skip to content
/ graph Public

a graph library using an adjacency list data structure

Notifications You must be signed in to change notification settings

tlehman/graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

a library providing graph data structures and algorithms

To get started, you can import this repo directly in your program:

import "github.com/tlehman/graph"

Then new up a graph and start adding to it:

g := graph.New()  // defaults to directed, unweighted
g.addEdge(1, 2)
g.addEdge(1, 3)
g.addEdge(1, 4)
g.addEdge(4, 5)
g.addEdge(5, 2)
g.addEdge(4, 2)
g.addEdge(2, 6)
g.addEdge(6, 5)
fmt.Println(g)

graph image

By default the graph prints out in the DOT graph description language

Algorithms

After adding everything to the graph, you can perform:

  • Breadth-first search
  • Find connected components
  • Find minimum spanning trees (only relevant if weighted)
  • Compute distances between vertices

About

a graph library using an adjacency list data structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages