Object
unless it is constrained by using a method like nodeOrder, or the builder is
constructed based on an existing Network using from(Network).
Object
unless it is constrained by using a method like edgeOrder, or the builder is
constructed based on an existing Network using from(Network).
MutableNetwork or ImmutableNetwork with
user-defined properties.
A Network built by this class has the following default properties:
Network#nodes() and Network#edges() in the order in which the
elements were added (insertion order)
Networks 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 network
MutableNetwork<String, Integer> network =
NetworkBuilder.directed().allowsParallelEdges(true).build();
flightNetwork.addEdge("LAX", "ATL", 3025);
flightNetwork.addEdge("LAX", "ATL", 1598);
flightNetwork.addEdge("ATL", "LAX", 2450);
// Building a immutable network
ImmutableNetwork<String, Integer> immutableNetwork =
NetworkBuilder.directed()
.allowsParallelEdges(true)
.<String, Integer>immutable()
.addEdge("LAX", "ATL", 3025)
.addEdge("LAX", "ATL", 1598)
.addEdge("ATL", "LAX", 2450)
.build();
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | |
| pack-priv ElementOrder | |
| pack-priv Optional |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public NetworkBuilder | allowsParallelEdges(boolean allowsParallelEdges)
Specifies whether the network will allow parallel edges. |
| public NetworkBuilder | allowsSelfLoops(boolean allowsSelfLoops)
Specifies whether the network will allow self-loops (edges that connect a node to itself). |
| public <N1 extends N, E1 extends E> MutableNetwork | |
| private <N1 extends N, E1 extends E> NetworkBuilder | |
| public static NetworkBuilder | |
| public <E1 extends E> NetworkBuilder | edgeOrder(ElementOrder<E1> edgeOrder)
Specifies the order of iteration for the elements of |
| public NetworkBuilder | |
| public NetworkBuilder | |
| public static <N, E> NetworkBuilder | from(Network<N, E> network)
Returns a |
| public <N1 extends N, E1 extends E> ImmutableNetwork. | |
| public <N1 extends N> NetworkBuilder | nodeOrder(ElementOrder<N1> nodeOrder)
Specifies the order of iteration for the elements of |
| public static NetworkBuilder |
| allowsParallelEdges | back to summary |
|---|---|
| pack-priv boolean allowsParallelEdges | |
| edgeOrder | back to summary |
|---|---|
| pack-priv ElementOrder<? super E> edgeOrder | |
| expectedEdgeCount | back to summary |
|---|---|
| pack-priv Optional<Integer> expectedEdgeCount | |
| NetworkBuilder | back to summary |
|---|---|
| private NetworkBuilder(boolean directed) Creates a new instance with the specified edge directionality. | |
| allowsParallelEdges | back to summary |
|---|---|
| public NetworkBuilder Specifies whether the network will allow parallel edges. Attempting to add a parallel edge to a
network that does not allow them will throw an The default value is
| |
| allowsSelfLoops | back to summary |
|---|---|
| public NetworkBuilder Specifies whether the network will allow self-loops (edges that connect a node to itself).
Attempting to add a self-loop to a network that does not allow them will throw an The default value is
| |
| build | back to summary |
|---|---|
| public <N1 extends N, E1 extends E> MutableNetwork Returns an empty | |
| cast | back to summary |
|---|---|
private <N1 extends N, E1 extends E> NetworkBuilder
| |
| directed | back to summary |
|---|---|
| public static NetworkBuilder Returns a | |
| edgeOrder | back to summary |
|---|---|
| public <E1 extends E> NetworkBuilder Specifies the order of iteration for the elements of The default value is | |
| expectedEdgeCount | back to summary |
|---|---|
| public NetworkBuilder Specifies the expected number of edges in the network.
| |
| expectedNodeCount | back to summary |
|---|---|
| public NetworkBuilder Specifies the expected number of nodes in the network.
| |
| from | back to summary |
|---|---|
| public static <N, E> NetworkBuilder Returns a The "queryable" properties are those that are exposed through the | |
| immutable | back to summary |
|---|---|
| public <N1 extends N, E1 extends E> ImmutableNetwork. Returns an The returned builder can be used for populating an
| |
| nodeOrder | back to summary |
|---|---|
| public <N1 extends N> NetworkBuilder Specifies the order of iteration for the elements of The default value is | |
| undirected | back to summary |
|---|---|
| public static NetworkBuilder Returns a | |