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

Commit

Permalink
Add incidence edge/arc enumerator interfaces.
Browse files Browse the repository at this point in the history
re: #11
  • Loading branch information
sdboyer committed Apr 18, 2014
1 parent e00fa04 commit c43c279
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ type EdgeEnumerator interface {
EachEdge(f func(Edge))
}

// An IncidentEdgeEnumerator iteratively enumerates a given vertex's incident edges.
type IncidentEdgeEnumerator interface {
EachEdgeIncidentTo(Vertex, f func(Edge)) bool
}

// An IncidentArcEnumerator iteratively enumerates a given vertex's incident arcs (directed edges).
// One enumerator provides inbound edges, the other outbound edges.
type IncidentArcEnumerator interface {
EachArcFrom(Vertex, f func(Edge)) bool
EachArcTo(Vertex, f func(Edge)) bool
}

// An AdjacencyEnumerator iteratively enumerates a given vertex's adjacent vertices.
type AdjacencyEnumerator interface {
EachAdjacent(start Vertex, f func(adjacent Vertex))
Expand All @@ -39,7 +51,7 @@ type VertexMembershipChecker interface {
// An InOutDegreeChecker reports the number of edges incident to a given vertex.
// TODO use this
type DegreeChecker interface {
Degree(Vertex) (degree int, exists bool) // Number of incident edges; if vertex is present
DegreeOf(Vertex) (degree int, exists bool) // Number of incident edges; if vertex is present
}

// An InOutDegreeChecker reports the number of in or out-edges a given vertex has.
Expand Down

0 comments on commit c43c279

Please sign in to comment.