Package com.jgalgo.alg.traversal
Interface NeighborSampler.Int
- All Superinterfaces:
NeighborSampler<Integer,,Integer> RandomizedAlgorithm
- Enclosing interface:
- NeighborSampler<V,
E>
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
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
-1if 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.Please usesample(int)instead to avoid un/boxing.Sample a neighbor of the given vertex.- Specified by:
samplein interfaceNeighborSampler<Integer,Integer> - Parameters:
vertex- the vertex to sample from- Returns:
- the sampled neighbor, maybe be
nullif there are no neighbors or some other reason the implementation decides to returnnull(for example if some vertices are filtered out).
-
graph
IntGraph graph()Description copied from interface:NeighborSamplerGet the graph this sampler is sampling from.- Specified by:
graphin interfaceNeighborSampler<Integer,Integer> - Returns:
- the graph this sampler is sampling from
-
sample(int)instead to avoid un/boxing.