List of usage examples for com.google.common.graph GraphBuilder expectedNodeCount
Optional expectedNodeCount
To view the source code for com.google.common.graph GraphBuilder expectedNodeCount.
Click Source Link
From source file:edu.uci.ics.jung.graph.TreeBuilder.java
/** Returns an empty {@link MutableCTree} with the properties of this {@link TreeBuilder}. */ // TODO(jrtom): decide how we're going to handle different implementations. // For the graph stuff, we don't really need different implementations, but // for trees, maybe we do; at least for binary trees vs. trees with no restrictions on outgoing edges... public <N1 extends N> MutableCTree<N1> build() { GraphBuilder<Object> graphBuilder = GraphBuilder.directed().allowsSelfLoops(false); if (expectedNodeCount.isPresent()) { graphBuilder = graphBuilder.expectedNodeCount(expectedNodeCount.get()); }//from ww w . j av a 2 s. c o m MutableGraph<N1> delegate = graphBuilder.nodeOrder(nodeOrder).build(); @SuppressWarnings("unchecked") Optional<N1> rootCast = (Optional<N1>) root; return new DelegateCTree<N1>(delegate, rootCast); }