HnswUtil (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.util.hnsw, class: HnswUtil

Package org.apache.lucene.util.hnsw

# Class HnswUtil

java.lang.Object
org.apache.lucene.util.hnsw.HnswUtil

public class HnswUtil extends Object
Utilities for use in tests involving HNSW graphs

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `graphIsRooted(IndexReader reader, String vectorField)`
  In graph theory, "connected components" are really defined only for undirected (ie bidirectional) graphs.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### graphIsRooted

    public static boolean graphIsRooted(IndexReader reader, String vectorField) throws IOException
    In graph theory, "connected components" are really defined only for undirected (ie bidirectional) graphs. Our graphs are directed, because of pruning, but they are *mostly* undirected. In this case we compute components starting from a single node so what we are really measuring is whether the graph is a "rooted graph". TODO: measure whether the graph is "strongly connected" ie there is a path from every node to every other node.
    Throws:
      `IOException`