reformat method comments to 80 columns

This commit is contained in:
Sonia Keys
2014-02-19 15:41:31 -05:00
parent 93defd9d09
commit a62b9c4064

View File

@@ -23,9 +23,10 @@ type Graph interface {
// Degree is equivalent to len(Successors(node)) + len(Predecessors(node)). // Degree is equivalent to len(Successors(node)) + len(Predecessors(node)).
// This means that reflexive edges are counted twice. // This means that reflexive edges are counted twice.
Degree(node Node) int Degree(node Node) int
// NodeList returns a list of all nodes in no particular order, useful for determining // NodeList returns a list of all nodes in no particular order, useful for
// things like if a graph is fully connected. The caller is free to modify this list. // determining things like if a graph is fully connected. The caller is
// Implementations should construct a new list and not return internal representation. // free to modify this list. Implementations should construct a new list
// and not return internal representation.
NodeList() []Node NodeList() []Node
// Neighbors returns all nodes connected by any edge to this node. // Neighbors returns all nodes connected by any edge to this node.
Neighbors(node Node) []Node Neighbors(node Node) []Node
@@ -42,14 +43,15 @@ type DirectedGraph interface {
// Successors gives the nodes connected by OUTBOUND edges. // Successors gives the nodes connected by OUTBOUND edges.
// If the graph is an undirected graph, this set is equal to Predecessors. // If the graph is an undirected graph, this set is equal to Predecessors.
Successors(node Node) []Node Successors(node Node) []Node
// IsSuccessor returns true if successor shows up in the list returned by Successors(node). // IsSuccessor returns true if successor shows up in the list returned by
// If node doesn't exist, this should always return false. // Successors(node). If node doesn't exist, this should always return false.
IsSuccessor(node, successor Node) bool IsSuccessor(node, successor Node) bool
// Predecessors gives the nodes connected by INBOUND edges. // Predecessors gives the nodes connected by INBOUND edges.
// If the graph is an undirected graph, this set is equal to Successors. // If the graph is an undirected graph, this set is equal to Successors.
Predecessors(node Node) []Node Predecessors(node Node) []Node
// IsPredecessor returns true if predecessor shows up in the list returned by Predecessors(node). // IsPredecessor returns true if predecessor shows up in the list returned
// If node doesn't exist, this should always return false. // by Predecessors(node). If node doesn't exist, this should always return
// false.
IsPredecessor(node, predecessor Node) bool IsPredecessor(node, predecessor Node) bool
} }
@@ -114,21 +116,25 @@ type HeuristicCoster interface {
// Mutable graphs should always record the IDs as they are represented -- which means they are sparse by nature. // Mutable graphs should always record the IDs as they are represented -- which means they are sparse by nature.
type MutableGraph interface { type MutableGraph interface {
CostGraph CostGraph
// NewNode adds a node with an arbitrary ID and returns the new, unique ID used. // NewNode adds a node with an arbitrary ID and returns the new, unique ID
// used.
NewNode(successors []Node) Node NewNode(successors []Node) Node
// The graph itself is responsible for adding reciprocal edges if it's undirected. // The graph itself is responsible for adding reciprocal edges if it's
// Likewise, the graph itself must add any non-existant nodes listed in successors. // undirected. Likewise, the graph itself must add any non-existant nodes
// listed in successors.
AddNode(node Node, successors []Node) AddNode(node Node, successors []Node)
// For a digraph, adds node1->node2; the graph is free to initialize this to any // For a digraph, adds node1->node2; the graph is free to initialize this
// value it wishes. Node1 must exist, or it will result in undefined behavior. // to any value it wishes. Node1 must exist, or it will result in undefined
// Node2 must be created by the function if absent. // behavior. Node2 must be created by the function if absent.
AddEdge(e Edge) AddEdge(e Edge)
// The behavior is undefined if the edge has not been created with AddEdge (or the edge was // The behavior is undefined if the edge has not been created with AddEdge
// removed before this function was called). For a directed graph only sets node1->node2. // (or the edge was removed before this function was called). For a
// directed graph only sets node1->node2.
SetEdgeCost(e Edge, cost float64) SetEdgeCost(e Edge, cost float64)
// The graph is reponsible for removing edges to a node that is removed. // The graph is reponsible for removing edges to a node that is removed.
RemoveNode(node Node) RemoveNode(node Node)
// The graph is responsible for removing reciprocal edges if it's undirected. // The graph is responsible for removing reciprocal edges if it's
// undirected.
RemoveEdge(e Edge) RemoveEdge(e Edge)
// EmptyGraph clears the graph of all nodes and edges. // EmptyGraph clears the graph of all nodes and edges.
EmptyGraph() EmptyGraph()