public class SamplingSubgraphIterator<T extends Edge> extends Object implements Iterator<Graph<T>>, Serializable
Callers specify how much of the backing graph should be sampled using an
array of probabilities. Each probability corresponds to how likely a
subgraph with k
vertices will be expanded to include k+1
vertices. The product of all the probabilities is the percentage of the
subgraphs that are expected to be sampled. For example, to sample 25% of the
size-3 subgraphs, the probilities [1, 1, .25]
or [1, .5, .5]
may be used. In general, it is preferrable to set only the last probability
to the percentage of subgraphs desired (as in the first of the previous two
examples) as it is less likely to prune away unintentionally larger portions
of the possible subgraph space. See the reference for further details on
performance.
This class is not thread-safe and does not support the remove()
method.
Constructor and Description |
---|
SamplingSubgraphIterator(Graph<T> g,
int subgraphSize,
double[] traversalProbabilitiesAtDepth)
Constructs an iterator over all the subgraphs of
g with the
specified subgraph size, where the list of probabilities is used to
decide probabilistically whether the next level of expansion should be
taken. |
public SamplingSubgraphIterator(Graph<T> g, int subgraphSize, double[] traversalProbabilitiesAtDepth)
g
with the
specified subgraph size, where the list of probabilities is used to
decide probabilistically whether the next level of expansion should be
taken.g
- a graphsubgraphSize
- the size of the subgraphs to returntraversalProbabilitiesAtDepth
- an array of probabilities where each
index i
corresponds to the probability of expanding the
subgraph at depth i
. This array must be the same size as
the the number of desired vertices in the subgraph.IllegalArgumentException
- if g
, NullPointerException
- if g
or traversalProbabilitiesAtDepth
is null
Copyright © 2012. All Rights Reserved.