public class ChainGenerator extends BaseGenerator
This generator creates a chain graph (much like a linked-list). By default, the graph is directed and doubly linked (much like a doubly linked-list). That is, each node has an edge to the next node in the chain, and one going back to the previous (except for the first and last nodes). A loop back edge can be added such that the last node in the chain has an edge directly back to the starting node.
Calling begin()
will add an initial node with no edges. Each call
to nextEvents()
will add a new node, connected to the previous node,
in a chain. If the graph is directed and doubly linked, each call will result
in the addition of two new edges, otherwise just a single edge is added. Thus,
if the graph is undirected, then the doubly linked parameter is ignored, and
only single edges are created between nodes.
If you are displaying the graph, directed and doubly-linked chain graphs are
best viewed with the cubic-curve
edge shape CSS property, though it
will require the use of the gs-ui renderer to work.
Constructor and Description |
---|
ChainGenerator()
New chain generator.
|
ChainGenerator(boolean directed,
boolean doublyLinked,
boolean loopBack)
New chain generator.
|
Modifier and Type | Method and Description |
---|---|
void |
begin()
Add an initial node.
|
void |
end()
If the graph is set to have a loop back edge, this method will add it.
|
boolean |
nextEvents()
Add a new node (link) in the chain.
|
addEdgeAttribute, addEdgeAttribute, addEdgeAttribute, addEdgeLabels, addNodeAttribute, addNodeAttribute, addNodeAttribute, addNodeLabels, isUsingInternalGraph, removeEdgeAttribute, removeNodeAttribute, setDirectedEdges, setRandomSeed, setUseInternalGraph
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
public ChainGenerator()
public ChainGenerator(boolean directed, boolean doublyLinked, boolean loopBack)
directed
- Should the edges be directed?doublyLinked
- Should the nodes be doubly linked?loopBack
- Should the graph have a loop back edge?public void begin()
Generator.begin()
public boolean nextEvents()
Generator.nextEvents()
public void end()
end
in interface Generator
end
in class BaseGenerator
Generator.end()