Class IncompleteGridGenerator
java.lang.Object
org.graphstream.stream.SourceBase
org.graphstream.algorithm.generator.BaseGenerator
org.graphstream.algorithm.generator.IncompleteGridGenerator
- All Implemented Interfaces:
Generator
,org.graphstream.stream.Source
public class IncompleteGridGenerator extends BaseGenerator
A grid generator with holes.
- Author:
- Guilhelm Savin
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description IncompleteGridGenerator()
New generator.IncompleteGridGenerator(boolean cross, float holeProbability, int holeMaxSize, int holesPerStep)
New generator. -
Method Summary
Modifier and Type Method Description void
begin()
Begin the graph generation.void
end()
End the graph generation by finalizing it.boolean
nextEvents()
Grow the graph.Methods inherited from class org.graphstream.algorithm.generator.BaseGenerator
addEdgeAttribute, addEdgeAttribute, addEdgeAttribute, addEdgeLabels, addNodeAttribute, addNodeAttribute, addNodeAttribute, addNodeLabels, isUsingInternalGraph, removeEdgeAttribute, removeNodeAttribute, setDirectedEdges, setRandomSeed, setUseInternalGraph
Methods inherited from class org.graphstream.stream.SourceBase
addAttributeSink, addElementSink, addSink, attributeSinks, clearAttributeSinks, clearElementSinks, clearSinks, elementSinks, removeAttributeSink, removeElementSink, removeSink, sendAttributeChangedEvent, sendAttributeChangedEvent, sendEdgeAdded, sendEdgeAdded, sendEdgeAttributeAdded, sendEdgeAttributeAdded, sendEdgeAttributeChanged, sendEdgeAttributeChanged, sendEdgeAttributeRemoved, sendEdgeAttributeRemoved, sendEdgeRemoved, sendEdgeRemoved, sendGraphAttributeAdded, sendGraphAttributeAdded, sendGraphAttributeChanged, sendGraphAttributeChanged, sendGraphAttributeRemoved, sendGraphAttributeRemoved, sendGraphCleared, sendGraphCleared, sendNodeAdded, sendNodeAdded, sendNodeAttributeAdded, sendNodeAttributeAdded, sendNodeAttributeChanged, sendNodeAttributeChanged, sendNodeAttributeRemoved, sendNodeAttributeRemoved, sendNodeRemoved, sendNodeRemoved, sendStepBegins, sendStepBegins
-
Constructor Details
-
IncompleteGridGenerator
public IncompleteGridGenerator()New generator. -
IncompleteGridGenerator
public IncompleteGridGenerator(boolean cross, float holeProbability, int holeMaxSize, int holesPerStep)New generator.- Parameters:
cross
- connect nodes diagonallyholeProbability
- probability of an hole in the gridholeMaxSize
- max size of holesholesPerStep
- number of attempt to create a hole by step
-
-
Method Details
-
begin
public void begin()Description copied from interface:Generator
Begin the graph generation. This usually is the place for initialization of the generator. After calling this method, call theGenerator.nextEvents()
method to add elements to the graph. -
nextEvents
public boolean nextEvents()Grow the graph. If grid dimensions are width x height, then after a call to this method dimensions will be (width+1)x(height+1). Eventually create some hopes.- Returns:
- true while there are elements to add to the graph.
- See Also:
Generator.nextEvents()
-
end
public void end()Description copied from class:BaseGenerator
End the graph generation by finalizing it. Once theGenerator.nextEvents()
method returned false (or even if you stop before), this method must be called to finish the graph. In addition, BaseGenerator adds a "clear" operations that removes all the kept edges and nodes identifiers and the associated data.- Specified by:
end
in interfaceGenerator
- Overrides:
end
in classBaseGenerator
-