public interface GraphBuilder
Modifier and Type | Method and Description |
---|---|
default void |
buildEdge(java.lang.Object from,
java.lang.Object to)
Build a new edge between the two objects.
|
default void |
buildEdge(java.lang.Object from,
java.lang.Object to,
double weight)
Build a new edge between the two objects, associating it with a weight.
|
void |
buildEdge(java.lang.Object from,
java.lang.Object to,
double weight,
java.lang.Object value)
Build a new edge between the two objects, assocating it with a weight and an object.
|
Graph |
buildGraph()
Build the graph with all its nodes and edges which were built.
|
default void |
buildNode(java.lang.Object value)
Build a node.
|
void |
buildNode(java.lang.Object key,
java.lang.Object value)
Build a node.
|
static GraphBuilder |
newBasicGraphBuilder()
Returns a new basic graph builder.
|
static GraphBuilder |
newCachedGraphBuilder()
Returns a new cached graph builder.
|
void |
startNewGraph()
Tells the builder to start a new graph and therefore get rid of certain stored state.
|
static GraphBuilder newCachedGraphBuilder()
startNewGraph()
is called. Note that due to this, the startNewGraph()
method will erase state of existing nodes, and should therefore not be used while the graph is still being used.static GraphBuilder newBasicGraphBuilder()
startNewGraph()
is safe, as it won't erase any state from
existing graphs.void startNewGraph()
void buildNode(java.lang.Object key, java.lang.Object value)
Node.getValue()
, and the key can be used to
build edges with.key
- The key to associate the new node with within this builder, for building edges.value
- The value to use for the new node's value.default void buildNode(java.lang.Object value)
value
- Both the key and the value, as in buildNode(value, value).default void buildEdge(java.lang.Object from, java.lang.Object to)
buildNode(Object, Object)
method or to the value passed to the
buildNode(Object)
method. If either or both of the nodes don't exist, the method will
silently fail.from
- The object to build the edge from.to
- The object to build the edge to.default void buildEdge(java.lang.Object from, java.lang.Object to, double weight)
buildEdge(Object, Object)
.weight
- The new weight of the edge.void buildEdge(java.lang.Object from, java.lang.Object to, double weight, java.lang.Object value)
buildEdge(Object, Object)
.weight
- The new weight of the edge.value
- The value of the ddge, as in Edge.getValue()
.Graph buildGraph()