graph/topo: rename VertexOrdering => DegeneracyOrdering

This commit is contained in:
kortschak
2017-09-15 11:44:48 +09:30
committed by Dan Kortschak
parent f818f8f7a9
commit db6d01ed81
2 changed files with 5 additions and 5 deletions

View File

@@ -10,9 +10,9 @@ import (
"gonum.org/v1/gonum/graph/internal/set"
)
// VertexOrdering returns the vertex ordering and the k-cores of
// DegeneracyOrdering returns the degeneracy ordering and the k-cores of
// the undirected graph g.
func VertexOrdering(g graph.Undirected) (order []graph.Node, cores [][]graph.Node) {
func DegeneracyOrdering(g graph.Undirected) (order []graph.Node, cores [][]graph.Node) {
order, offsets := degeneracyOrdering(g)
ordered.Reverse(order)
@@ -39,7 +39,7 @@ func KCore(k int, g graph.Undirected) []graph.Node {
return core
}
// degeneracyOrdering is the common code for VertexOrdering and KCore. It
// degeneracyOrdering is the common code for DegeneracyOrdering and KCore. It
// returns l, the nodes of g in optimal ordering for coloring number and
// s, a set of relative offsets into l for each k-core, where k is an index
// into s.

View File

@@ -48,7 +48,7 @@ var vOrderTests = []struct {
},
}
func TestVertexOrdering(t *testing.T) {
func TestDegeneracyOrdering(t *testing.T) {
for i, test := range vOrderTests {
g := simple.NewUndirectedGraph()
for u, e := range test.g {
@@ -60,7 +60,7 @@ func TestVertexOrdering(t *testing.T) {
g.SetEdge(simple.Edge{F: simple.Node(u), T: simple.Node(v)})
}
}
order, core := VertexOrdering(g)
order, core := DegeneracyOrdering(g)
if len(core)-1 != test.wantK {
t.Errorf("unexpected value of k for test %d: got: %d want: %d", i, len(core)-1, test.wantK)
}