Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

Commit

Permalink
community: fix comments
Browse files Browse the repository at this point in the history
Fix typos and revise Structure methods documentation.
  • Loading branch information
kortschak committed Aug 26, 2016
1 parent 75822ac commit fb9e4e9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
26 changes: 18 additions & 8 deletions community/louvain_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ type ReducedGraph interface {

// Structure returns the community structure of
// the current level of the module clustering.
// The first index of the returned value
// corresponds to the index of the nodes in the
// next higher level if it exists. The returned
// value should not be mutated.
// Each slice in the returned value recursively
// describes the membership of a community at
// the current level by indexing via the node
// ID into the structure of the non-nil
// ReducedGraph returned by Expanded, or when the
// ReducedGraph is nil, by containing nodes
// from the original input graph.
//
// The returned value should not be mutated.
Structure() [][]graph.Node

// Expanded returns the next lower level of the
Expand Down Expand Up @@ -150,10 +155,15 @@ type ReducedMultiplex interface {

// Structure returns the community structure of
// the current level of the module clustering.
// The first index of the returned value
// corresponds to the index of the nodes in the
// next higher level if it exists. The returned
// value should not be mutated.
// Each slice in the returned value recursively
// describes the membership of a community at
// the current level by indexing via the node
// ID into the structure of the non-nil
// ReducedGraph returned by Expanded, or when the
// ReducedGraph is nil, by containing nodes
// from the original input graph.
//
// The returned value should not be mutated.
Structure() [][]graph.Node

// Expanded returns the next lower level of the
Expand Down
4 changes: 2 additions & 2 deletions community/louvain_directed.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func qDirected(g graph.Directed, communities [][]graph.Node, resolution float64)

// louvainDirected returns the hierarchical modularization of g at the given
// resolution using the Louvain algorithm. If src is nil, rand.Intn is used
// as the random generator. Louvain will panic if g has any edge with negative
// as the random generator. louvainDirected will panic if g has any edge with negative
// edge weight.
func louvainDirected(g graph.Directed, resolution float64, src *rand.Rand) ReducedGraph {
// See louvain.tex for a detailed description
Expand Down Expand Up @@ -407,7 +407,7 @@ type directedLocalMover struct {

// nodes is the set of working nodes.
nodes []graph.Node
// edgeWeightOf is the weighted degree
// edgeWeightsOf is the weighted degree
// of each node indexed by ID.
edgeWeightsOf []directedWeights

Expand Down
2 changes: 1 addition & 1 deletion community/louvain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func linksTo(i ...int) set {

type layer struct {
g []set
edgeWeight float64 // Zero edge weight is interpretted as 1.0.
edgeWeight float64 // Zero edge weight is interpreted as 1.0.
weight float64
}

Expand Down
2 changes: 1 addition & 1 deletion community/louvain_undirected.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func qUndirected(g graph.Undirected, communities [][]graph.Node, resolution floa

// louvainUndirected returns the hierarchical modularization of g at the given
// resolution using the Louvain algorithm. If src is nil, rand.Intn is used as
// the random generator. Louvain will panic if g has any edge with negative edge
// the random generator. louvainUndirected will panic if g has any edge with negative edge
// weight.
//
// graph.Undirect may be used as a shim to allow modularization of directed graphs.
Expand Down

0 comments on commit fb9e4e9

Please sign in to comment.