org.graphstream.algorithm.generator
Class IncompleteGridGenerator

java.lang.Object
  extended by org.graphstream.stream.SourceBase
      extended by org.graphstream.algorithm.generator.BaseGenerator
          extended by 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
 
Nested classes/interfaces inherited from class org.graphstream.stream.SourceBase
org.graphstream.stream.SourceBase.ElementType
 
Constructor Summary
IncompleteGridGenerator()
          New generator.
IncompleteGridGenerator(boolean cross, float holeProbability, int holeMaxSize, int holesPerStep)
          New generator.
 
Method Summary
 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, addEdgeLabels, addNodeAttribute, addNodeLabels, isUsingInternalGraph, removeEdgeAttribute, removeNodeAttribute, setDirectedEdges, setEdgeAttributesRange, setNodeAttributesRange, 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.graphstream.stream.Source
addAttributeSink, addElementSink, addSink, clearAttributeSinks, clearElementSinks, clearSinks, removeAttributeSink, removeElementSink, removeSink
 

Constructor Detail

IncompleteGridGenerator

public IncompleteGridGenerator()
New generator.


IncompleteGridGenerator

public IncompleteGridGenerator(boolean cross,
                               float holeProbability,
                               int holeMaxSize,
                               int holesPerStep)
New generator.

Parameters:
cross - connect nodes diagonally
holeProbability - probability of an hole in the grid
holeMaxSize - max size of holes
holesPerStep - number of attempt to create a hole by step
Method Detail

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 the Generator.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 the Generator.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 interface Generator
Overrides:
end in class BaseGenerator


Copyright © 2013. All Rights Reserved.