Package com.google.common.graph
Class ImmutableNetwork<N,E>
- java.lang.Object
-
- com.google.common.graph.AbstractNetwork<N,E>
-
- com.google.common.graph.StandardNetwork<N,E>
-
- com.google.common.graph.ImmutableNetwork<N,E>
-
- Type Parameters:
N- Node parameter typeE- Edge parameter type
- All Implemented Interfaces:
Network<N,E>,PredecessorsFunction<N>,SuccessorsFunction<N>
public final class ImmutableNetwork<N,E> extends StandardNetwork<N,E>
ANetworkwhose elements and structural relationships will never change. Instances of this class may be obtained withcopyOf(Network).See the Guava User's Guide's discussion of the
Immutable*types for more information on the properties and guarantees provided by this class.- Since:
- 20.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableNetwork.Builder<N,E>A builder for creatingImmutableNetworkinstances, especiallystatic finalnetworks.
-
Field Summary
-
Fields inherited from class com.google.common.graph.StandardNetwork
edgeToReferenceNode, nodeConnections
-
-
Constructor Summary
Constructors Modifier Constructor Description privateImmutableNetwork(Network<N,E> network)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private static <N,E>
Function<E,N>adjacentNodeFn(Network<N,E> network, N node)ImmutableGraph<N>asGraph()Returns a live view of this network as aGraph.private static <N,E>
NetworkConnections<N,E>connectionsOf(Network<N,E> network, N node)static <N,E>
ImmutableNetwork<N,E>copyOf(ImmutableNetwork<N,E> network)Deprecated.no need to use thisstatic <N,E>
ImmutableNetwork<N,E>copyOf(Network<N,E> network)Returns an immutable copy ofnetwork.private static <N,E>
java.util.Map<E,N>getEdgeToReferenceNode(Network<N,E> network)private static <N,E>
java.util.Map<N,NetworkConnections<N,E>>getNodeConnections(Network<N,E> network)private static <N,E>
Function<E,N>sourceNodeFn(Network<N,E> network)private static <N,E>
Function<E,N>targetNodeFn(Network<N,E> network)-
Methods inherited from class com.google.common.graph.StandardNetwork
adjacentNodes, allowsParallelEdges, allowsSelfLoops, checkedConnections, checkedReferenceNode, containsEdge, containsNode, edgeOrder, edges, edgesConnecting, incidentEdges, incidentNodes, inEdges, isDirected, nodeOrder, nodes, outEdges, predecessors, successors
-
Methods inherited from class com.google.common.graph.AbstractNetwork
adjacentEdges, degree, edgeConnecting, edgeConnecting, edgeConnectingOrNull, edgeConnectingOrNull, edgesConnecting, equals, hasEdgeConnecting, hasEdgeConnecting, hashCode, inDegree, isOrderingCompatible, outDegree, toString, validateEndpoints
-
-
-
-
Method Detail
-
copyOf
public static <N,E> ImmutableNetwork<N,E> copyOf(Network<N,E> network)
Returns an immutable copy ofnetwork.
-
copyOf
@Deprecated public static <N,E> ImmutableNetwork<N,E> copyOf(ImmutableNetwork<N,E> network)
Deprecated.no need to use thisSimply returns its argument.
-
asGraph
public ImmutableGraph<N> asGraph()
Description copied from interface:NetworkReturns a live view of this network as aGraph. The resultingGraphwill have an edge connecting node A to node B if thisNetworkhas an edge connecting A to B.If this network
allows parallel edges, parallel edges will be treated as if collapsed into a single edge. For example, theNetwork.degree(Object)of a node in theGraphview may be less than the degree of the same node in thisNetwork.
-
getNodeConnections
private static <N,E> java.util.Map<N,NetworkConnections<N,E>> getNodeConnections(Network<N,E> network)
-
getEdgeToReferenceNode
private static <N,E> java.util.Map<E,N> getEdgeToReferenceNode(Network<N,E> network)
-
connectionsOf
private static <N,E> NetworkConnections<N,E> connectionsOf(Network<N,E> network, N node)
-
-