Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Commit

Permalink
Finish pulling out detritus, whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Mar 12, 2014
1 parent 7531a38 commit 4f1c5e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions al.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"sync"
)

type al map[Vertex]VertexSet
type al map[Vertex]map[Vertex]struct{}

// Helper to not have to write struct{} everywhere.
var keyExists = struct{}{}
Expand Down Expand Up @@ -105,13 +105,13 @@ func (g *adjacencyList) EnsureVertex(vertices ...Vertex) {
func (g *adjacencyList) ensureVertex(vertices ...Vertex) {
// TODO this is horrible, but the reflection approach in the testing harness requires it...for now
if g.list == nil {
g.list = make(map[Vertex]VertexSet)
g.list = make(map[Vertex]map[Vertex]struct{})
}

for _, vertex := range vertices {
if !g.hasVertex(vertex) {
// TODO experiment with different lengths...possibly by analyzing existing density?
g.list[vertex] = make(VertexSet, 10)
g.list[vertex] = make(map[Vertex]struct{}, 10)
}
}

Expand Down
2 changes: 1 addition & 1 deletion directed.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Directed struct {
func NewDirected() *Directed {
list := &Directed{}
// Cannot assign to promoted fields in a composite literals.
list.list = make(map[Vertex]VertexSet)
list.list = make(map[Vertex]map[Vertex]struct{})

// Type assertions to ensure interfaces are met
var _ Graph = list
Expand Down
2 changes: 1 addition & 1 deletion undirected.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Undirected struct {
func NewUndirected() *Undirected {
list := &Undirected{}
// Cannot assign to promoted fields in a composite literals.
list.list = make(map[Vertex]VertexSet)
list.list = make(map[Vertex]map[Vertex]struct{})

// Type assertions to ensure interfaces are met
var _ Graph = list
Expand Down

0 comments on commit 4f1c5e5

Please sign in to comment.