jtibshirani commented on code in PR #872: URL: https://github.com/apache/lucene/pull/872#discussion_r869686535
########## lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java: ########## @@ -43,7 +43,8 @@ public final class HnswGraphBuilder { /** Random seed for level generation; public to expose for testing * */ public static long randSeed = DEFAULT_RAND_SEED; - private final int maxConn; + private final int M; // max number of connections on upper layers + private final int maxConn0; // max number of connections on the 0th (last) layer Review Comment: Small comment, I think it'd be clearer to just store the parameter `M` and compute `maxConn0` on the fly. It's such a simple calculation it doesn't really help to store it. ########## lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java: ########## @@ -68,42 +69,43 @@ public final class HnswGraphBuilder { * * @param vectors the vectors whose relations are represented by the graph - must provide a * different view over those vectors than the one used to add via addGraphNode. - * @param maxConn the number of connections to make when adding a new graph node; roughly speaking - * the graph fanout. + * @param M the number of connections to make when adding a new graph node; roughly speaking the Review Comment: I guess we should update this to mention that the last layer is treated differently (it uses max 2*M connections?) ########## lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java: ########## @@ -256,10 +256,11 @@ public void testSearchWithSelectiveAcceptOrds() throws IOException { public void testSearchWithSkewedAcceptOrds() throws IOException { int nDoc = 1000; + int maxConn = 16; Review Comment: I guess this should be called `M`? Or maybe we don't even need to pull out this parameter? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org