public class RemoveAddEach<N,E> extends java.lang.Object implements perturber<N,E>
perturb()
, until all the edges have been
removed and added back.Constructor and Description |
---|
RemoveAddEach(Graph<N,E> graph)
Create new instance to iterate over the specified graph and remove then
add 1 edge on each call to perturb, until all edges have been removed
and added.
|
RemoveAddEach(Graph<N,E> graph,
float remove_edges,
int max_perturbs)
Create new instance to iterate over the specified graph and remove then
add up to remove_edges # of edges on each call to perturb, up to a maximum
number of perturbations.
|
Modifier and Type | Method and Description |
---|---|
int |
clear_removed_edges()
Clear state held for any removed edges.
|
java.util.List<Edge<N,E>> |
last_removed_edges() |
java.util.List<Edge<N,E>> |
perturb()
Carry out 1 perturbation of the graph, either removing the next group of
of edges from the graph, or adding back the group of edges removed in
the previous iteration.
|
java.util.List<Edge<N,E>> |
removed_edges() |
int |
restore()
Restore edges removed previously, up until the last call to
perturber.clear_removed_edges() . |
public RemoveAddEach(Graph<N,E> graph)
graph
- The graph to act on.public RemoveAddEach(Graph<N,E> graph, float remove_edges, int max_perturbs)
graph
- The graph to act onremove_edges
- The number of edges to remove/add at a time, on each
call to perturb. This may be specified either as
an absolute number of edges (> 1), or else as
a proportion of the number of nodes, (0 < x < 1).max_perturbs
- Limit the number of times groups of edges will be
removed. A value <= 0 means no limit.public java.util.List<Edge<N,E>> perturb()
public int restore()
perturber
perturber.clear_removed_edges()
. This also clears the remember, removed edges.public java.util.List<Edge<N,E>> removed_edges()
removed_edges
in interface perturber<N,E>
public int clear_removed_edges()
perturber
perturber.restore()
calls will
not be able to add back any of the edges held before the call to this
method.clear_removed_edges
in interface perturber<N,E>