/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node and edge maps. */ ConfigurableNetwork( NetworkBuilder<? super N, ? super E> builder, Map<N, NetworkConnections<N, E>> nodeConnections, Map<E, N> edgeToReferenceNode) { this.isDirected = builder.directed; this.allowsParallelEdges = builder.allowsParallelEdges; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); this.edgeOrder = builder.edgeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. This optimizes // methods that access the same node(s) repeatedly, such as Graphs.removeEdgesConnecting(). this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, NetworkConnections<N, E>>(nodeConnections) : new MapIteratorCache<N, NetworkConnections<N, E>>(nodeConnections); this.edgeToReferenceNode = new MapIteratorCache<>(edgeToReferenceNode); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node and edge maps. */ ConfigurableNetwork( NetworkBuilder<? super N, ? super E> builder, Map<N, NetworkConnections<N, E>> nodeConnections, Map<E, N> edgeToReferenceNode) { this.isDirected = builder.directed; this.allowsParallelEdges = builder.allowsParallelEdges; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); this.edgeOrder = builder.edgeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. This optimizes // methods that access the same node(s) repeatedly, such as Graphs.removeEdgesConnecting(). this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, NetworkConnections<N, E>>(nodeConnections) : new MapIteratorCache<N, NetworkConnections<N, E>>(nodeConnections); this.edgeToReferenceNode = new MapIteratorCache<>(edgeToReferenceNode); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node map. */ ConfigurableValueGraph( AbstractGraphBuilder<? super N> builder, Map<N, GraphConnections<N, V>> nodeConnections, long edgeCount) { this.isDirected = builder.directed; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, GraphConnections<N, V>>(nodeConnections) : new MapIteratorCache<N, GraphConnections<N, V>>(nodeConnections); this.edgeCount = checkNonNegative(edgeCount); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node and edge maps. */ ConfigurableNetwork( NetworkBuilder<? super N, ? super E> builder, Map<N, NetworkConnections<N, E>> nodeConnections, Map<E, N> edgeToReferenceNode) { this.isDirected = builder.directed; this.allowsParallelEdges = builder.allowsParallelEdges; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); this.edgeOrder = builder.edgeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. This optimizes // methods that access the same node(s) repeatedly, such as Graphs.removeEdgesConnecting(). this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, NetworkConnections<N, E>>(nodeConnections) : new MapIteratorCache<N, NetworkConnections<N, E>>(nodeConnections); this.edgeToReferenceNode = new MapIteratorCache<>(edgeToReferenceNode); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node map. */ ConfigurableValueGraph( AbstractGraphBuilder<? super N> builder, Map<N, GraphConnections<N, V>> nodeConnections, long edgeCount) { this.isDirected = builder.directed; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, GraphConnections<N, V>>(nodeConnections) : new MapIteratorCache<N, GraphConnections<N, V>>(nodeConnections); this.edgeCount = checkNonNegative(edgeCount); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node map. */ ConfigurableValueGraph( AbstractGraphBuilder<? super N> builder, Map<N, GraphConnections<N, V>> nodeConnections, long edgeCount) { this.isDirected = builder.directed; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, GraphConnections<N, V>>(nodeConnections) : new MapIteratorCache<N, GraphConnections<N, V>>(nodeConnections); this.edgeCount = checkNonNegative(edgeCount); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node and edge maps. */ ConfigurableNetwork( NetworkBuilder<? super N, ? super E> builder, Map<N, NetworkConnections<N, E>> nodeConnections, Map<E, N> edgeToReferenceNode) { this.isDirected = builder.directed; this.allowsParallelEdges = builder.allowsParallelEdges; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); this.edgeOrder = builder.edgeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. This optimizes // methods that access the same node(s) repeatedly, such as Graphs.removeEdgesConnecting(). this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, NetworkConnections<N, E>>(nodeConnections) : new MapIteratorCache<N, NetworkConnections<N, E>>(nodeConnections); this.edgeToReferenceNode = new MapIteratorCache<>(edgeToReferenceNode); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node and edge maps. */ ConfigurableNetwork( NetworkBuilder<? super N, ? super E> builder, Map<N, NetworkConnections<N, E>> nodeConnections, Map<E, N> edgeToReferenceNode) { this.isDirected = builder.directed; this.allowsParallelEdges = builder.allowsParallelEdges; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); this.edgeOrder = builder.edgeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. This optimizes // methods that access the same node(s) repeatedly, such as Graphs.removeEdgesConnecting(). this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, NetworkConnections<N, E>>(nodeConnections) : new MapIteratorCache<N, NetworkConnections<N, E>>(nodeConnections); this.edgeToReferenceNode = new MapIteratorCache<>(edgeToReferenceNode); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node map. */ ConfigurableValueGraph( AbstractGraphBuilder<? super N> builder, Map<N, GraphConnections<N, V>> nodeConnections, long edgeCount) { this.isDirected = builder.directed; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, GraphConnections<N, V>>(nodeConnections) : new MapIteratorCache<N, GraphConnections<N, V>>(nodeConnections); this.edgeCount = checkNonNegative(edgeCount); }
/** * Constructs a graph with the properties specified in {@code builder}, initialized with the given * node map. */ ConfigurableValueGraph( AbstractGraphBuilder<? super N> builder, Map<N, GraphConnections<N, V>> nodeConnections, long edgeCount) { this.isDirected = builder.directed; this.allowsSelfLoops = builder.allowsSelfLoops; this.nodeOrder = builder.nodeOrder.cast(); // Prefer the heavier "MapRetrievalCache" for nodes if lookup is expensive. this.nodeConnections = (nodeConnections instanceof TreeMap) ? new MapRetrievalCache<N, GraphConnections<N, V>>(nodeConnections) : new MapIteratorCache<N, GraphConnections<N, V>>(nodeConnections); this.edgeCount = checkNonNegative(edgeCount); }