Object
unless it is constrained by using a method like nodeOrder, or the builder is
constructed based on an existing Graph using from(Graph).
MutableGraph or ImmutableGraph with
user-defined properties.
A Graph built by this class has the following default properties:
Graph#nodes() in the order in which the elements were added (insertion
order)
Graphs built by this class also guarantee that each collection-returning accessor
returns a (live) unmodifiable view; see the external
documentation for details.
Examples of use:
// Building a mutable graph
MutableGraph<String> graph = GraphBuilder.undirected().allowsSelfLoops(true).build();
graph.putEdge("bread", "bread");
graph.putEdge("chocolate", "peanut butter");
graph.putEdge("peanut butter", "jelly");
// Building an immutable graph
ImmutableGraph<String> immutableGraph =
GraphBuilder.undirected()
.allowsSelfLoops(true)
.<String>immutable()
.putEdge("bread", "bread")
.putEdge("chocolate", "peanut butter")
.putEdge("peanut butter", "jelly")
.build();
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public GraphBuilder | allowsSelfLoops(boolean allowsSelfLoops)
Specifies whether the graph will allow self-loops (edges that connect a node to itself). |
| public <N1 extends N> MutableGraph | |
| private <N1 extends N> GraphBuilder | |
| pack-priv GraphBuilder | |
| public static GraphBuilder | |
| public GraphBuilder | |
| public static <N> GraphBuilder | |
| public <N1 extends N> ImmutableGraph. | |
| public <N1 extends N> GraphBuilder | incidentEdgeOrder(ElementOrder<N1> incidentEdgeOrder)
Specifies the order of iteration for the elements of |
| public <N1 extends N> GraphBuilder | nodeOrder(ElementOrder<N1> nodeOrder)
Specifies the order of iteration for the elements of |
| public static GraphBuilder |
| GraphBuilder | back to summary |
|---|---|
| private GraphBuilder(boolean directed) Creates a new instance with the specified edge directionality. | |
| allowsSelfLoops | back to summary |
|---|---|
| public GraphBuilder Specifies whether the graph will allow self-loops (edges that connect a node to itself).
Attempting to add a self-loop to a graph that does not allow them will throw an The default value is
| |
| build | back to summary |
|---|---|
| public <N1 extends N> MutableGraph Returns an empty | |
| cast | back to summary |
|---|---|
private <N1 extends N> GraphBuilder
| |
| copy | back to summary |
|---|---|
| pack-priv GraphBuilder | |
| directed | back to summary |
|---|---|
| public static GraphBuilder Returns a | |
| expectedNodeCount | back to summary |
|---|---|
| public GraphBuilder Specifies the expected number of nodes in the graph.
| |
| from | back to summary |
|---|---|
| public static <N> GraphBuilder Returns a The "queryable" properties are those that are exposed through the | |
| immutable | back to summary |
|---|---|
| public <N1 extends N> ImmutableGraph. Returns an The returned builder can be used for populating an Note that the returned builder will always have
| |
| incidentEdgeOrder | back to summary |
|---|---|
| public <N1 extends N> GraphBuilder Specifies the order of iteration for the elements of The default value is
| |
| nodeOrder | back to summary |
|---|---|
| public <N1 extends N> GraphBuilder Specifies the order of iteration for the elements of The default value is | |
| undirected | back to summary |
|---|---|
| public static GraphBuilder Returns a | |