Interface NeighborSampler.Int

All Superinterfaces:
NeighborSampler<Integer,Integer>, RandomizedAlgorithm
Enclosing interface:
NeighborSampler<V,E>

public static interface NeighborSampler.Int extends NeighborSampler<Integer,Integer>
Random neighbor sampler for IntGraph.
Author:
Barak Ugav
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.jgalgo.alg.traversal.NeighborSampler

    NeighborSampler.Int
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the graph this sampler is sampling from.
    int
    sample(int vertex)
    Sample a neighbor of the given vertex.
    default Integer
    sample(Integer vertex)
    Deprecated.
    Please use sample(int) instead to avoid un/boxing.

    Methods inherited from interface com.jgalgo.alg.common.RandomizedAlgorithm

    setSeed
  • Method Details

    • sample

      int sample(int vertex)
      Sample a neighbor of the given vertex.
      Parameters:
      vertex - the vertex to sample from
      Returns:
      the sampled neighbor, maybe be -1 if there are no neighbors or some other reason the implementation decides to return -1 (for example if some vertices are filtered out).
      Throws:
      NoSuchVertexException - if the vertex is not in the graph
    • sample

      @Deprecated default Integer sample(Integer vertex)
      Deprecated.
      Please use sample(int) instead to avoid un/boxing.
      Sample a neighbor of the given vertex.
      Specified by:
      sample in interface NeighborSampler<Integer,Integer>
      Parameters:
      vertex - the vertex to sample from
      Returns:
      the sampled neighbor, maybe be null if there are no neighbors or some other reason the implementation decides to return null (for example if some vertices are filtered out).
    • graph

      IntGraph graph()
      Description copied from interface: NeighborSampler
      Get the graph this sampler is sampling from.
      Specified by:
      graph in interface NeighborSampler<Integer,Integer>
      Returns:
      the graph this sampler is sampling from