public class RandomRemove<N,E> extends java.lang.Object implements perturber<N,E>
Constructor and Description |
---|
RandomRemove(Graph<N,E> graph)
Create new instance to randomly remove 1 edge on each call to
|
RandomRemove(Graph<N,E> graph,
float remove_edges)
Create new instance to iterate over the specified graph and remove then
add up to remove_edges # of edges on each call to
remove() , |
RandomRemove(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
remove() , |
Modifier and Type | Method and Description |
---|---|
int |
clear_removed_edges()
Clear state held for the removed edges.
|
boolean |
combine() |
void |
combine(boolean combine) |
java.util.List<Edge<N,E>> |
perturb()
Carry out another iteration of random-removes by restoring any previously
removed edges, clearing the removed_edge set, and then removing the next
random set of edges.
|
java.util.List<Edge<N,E>> |
remove()
Randomly remove edges from the graph, up to the specified number of edges
for the class.
|
java.util.List<Edge<N,E>> |
removed_edges() |
int |
restore()
Restore edges removed previously, up until the last call to
clear_removed_edges() . |
public RandomRemove(Graph<N,E> graph)
graph
- The graph to act on.public RandomRemove(Graph<N,E> graph, float remove_edges)
remove()
,graph
- The graph to act onremove_edges
- The number of edges to remove/add at a time, on each
call to remove. 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).public RandomRemove(Graph<N,E> graph, float remove_edges, int max_perturbs)
remove()
,graph
- The graph to act onremove_edges
- The number of edges to remove/add at a time, on each
call to remove. 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 void combine(boolean combine)
public boolean combine()
public java.util.List<Edge<N,E>> remove()
public int restore()
clear_removed_edges()
.public java.util.List<Edge<N,E>> removed_edges()
removed_edges
in interface perturber<N,E>
public int clear_removed_edges()
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>