From fb9e4e98b63a612d55b1dab54ba9fcdc764bd0c2 Mon Sep 17 00:00:00 2001 From: kortschak Date: Thu, 25 Aug 2016 12:11:36 +0930 Subject: [PATCH] community: fix comments Fix typos and revise Structure methods documentation. --- community/louvain_common.go | 26 ++++++++++++++++++-------- community/louvain_directed.go | 4 ++-- community/louvain_test.go | 2 +- community/louvain_undirected.go | 2 +- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/community/louvain_common.go b/community/louvain_common.go index cb9540fd..e806096a 100644 --- a/community/louvain_common.go +++ b/community/louvain_common.go @@ -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 @@ -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 diff --git a/community/louvain_directed.go b/community/louvain_directed.go index dce9e6da..a5a15f94 100644 --- a/community/louvain_directed.go +++ b/community/louvain_directed.go @@ -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 @@ -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 diff --git a/community/louvain_test.go b/community/louvain_test.go index c97f1136..6abf3e91 100644 --- a/community/louvain_test.go +++ b/community/louvain_test.go @@ -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 } diff --git a/community/louvain_undirected.go b/community/louvain_undirected.go index 091c2c3f..526cadaf 100644 --- a/community/louvain_undirected.go +++ b/community/louvain_undirected.go @@ -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.