Class ImmutableNetwork<N,E> 
- Type Parameters:
- N- Node parameter type
- E- Edge parameter type
- All Implemented Interfaces:
- Network<N,,- E> - PredecessorsFunction<N>,- SuccessorsFunction<N>
Network whose elements and structural relationships will never change. Instances of
 this class may be obtained with copyOf(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
- Author:
- James Sexton, Joshua O'Madadhain, Omar Darwish, Jens Nyman
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA builder for creatingImmutableNetworkinstances, especiallystatic finalnetworks.
- 
Method SummaryModifier and TypeMethodDescriptionadjacentNodes(N node) Returns a live view of the nodes which have an incident edge in common withnodein this network.booleanReturns true if this network allows parallel edges.booleanReturns true if this network allows self-loops (edges that connect a node to itself).asGraph()Returns a live view of this network as aGraph.static <N,E> ImmutableNetwork <N, E> copyOf(ImmutableNetwork<N, E> network) Deprecated.no need to use thisstatic <N,E> ImmutableNetwork <N, E> Returns an immutable copy ofnetwork.Returns the order of iteration for the elements ofNetwork.edges().edges()Returns all edges in this network, in the order specified byNetwork.edgeOrder().edgesConnecting(N nodeU, N nodeV) Returns a live view of the set of edges that each directly connectnodeUtonodeV.incidentEdges(N node) Returns a live view of the edges whoseincident nodesin this network includenode.incidentNodes(E edge) Returns the nodes which are the endpoints ofedgein this network.Returns a live view of all edges in this network which can be traversed in the direction (if any) of the edge to end atnode.booleanReturns true if the edges in this network are directed.Returns the order of iteration for the elements ofNetwork.nodes().nodes()Returns all nodes in this network, in the order specified byNetwork.nodeOrder().Returns a live view of all edges in this network which can be traversed in the direction (if any) of the edge starting fromnode.predecessors(N node) Returns a live view of all nodes in this network adjacent tonodewhich can be reached by traversingnode's incoming edges against the direction (if any) of the edge.successors(N node) Returns a live view of all nodes in this network adjacent tonodewhich can be reached by traversingnode's outgoing edges in the direction (if any) of the edge.Methods inherited from class com.google.common.graph.AbstractNetworkadjacentEdges, degree, edgeConnectingOrNull, edgeConnectingOrNull, edgeInvalidatableSet, edgesConnecting, equals, hasEdgeConnecting, hasEdgeConnecting, hashCode, inDegree, isOrderingCompatible, nodeInvalidatableSet, nodePairInvalidatableSet, outDegree, toString, validateEndpoints
- 
Method Details- 
copyOfReturns an immutable copy ofnetwork.
- 
copyOf@InlineMe(replacement="checkNotNull(network)", staticImports="com.google.common.base.Preconditions.checkNotNull") @Deprecated public static <N,E> ImmutableNetwork<N,E> copyOf(ImmutableNetwork<N, E> network) Deprecated.no need to use thisSimply returns its argument.
- 
asGraphDescription 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.
- 
nodesDescription copied from interface:NetworkReturns all nodes in this network, in the order specified byNetwork.nodeOrder().
- 
edgesDescription copied from interface:NetworkReturns all edges in this network, in the order specified byNetwork.edgeOrder().
- 
isDirectedpublic boolean isDirected()Description copied from interface:NetworkReturns true if the edges in this network are directed. Directed edges connect asource nodeto atarget node, while undirected edges connect a pair of nodes to each other.
- 
allowsParallelEdgespublic boolean allowsParallelEdges()Description copied from interface:NetworkReturns true if this network allows parallel edges. Attempting to add a parallel edge to a network that does not allow them will throw anIllegalArgumentException.
- 
allowsSelfLoopspublic boolean allowsSelfLoops()Description copied from interface:NetworkReturns true if this network allows 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 anIllegalArgumentException.
- 
nodeOrderDescription copied from interface:NetworkReturns the order of iteration for the elements ofNetwork.nodes().
- 
edgeOrderDescription copied from interface:NetworkReturns the order of iteration for the elements ofNetwork.edges().
- 
incidentEdgesDescription copied from interface:NetworkReturns a live view of the edges whoseincident nodesin this network includenode.This is equal to the union of Network.inEdges(Object)andNetwork.outEdges(Object).If nodeis removed from the network after this method is called, theSetviewreturned by this method will be invalidated, and will throwIllegalStateExceptionif it is accessed in any way, with the following exceptions:- view.equals(view)evaluates to- true(but any other- equals()expression involving- viewwill throw)
- hashCode()does not throw
- if nodeis re-added to the network after having been removed,view's behavior is undefined
 
- 
incidentNodesDescription copied from interface:NetworkReturns the nodes which are the endpoints ofedgein this network.
- 
adjacentNodesDescription copied from interface:NetworkReturns a live view of the nodes which have an incident edge in common withnodein this network.This is equal to the union of Network.predecessors(Object)andNetwork.successors(Object).If nodeis removed from the network after this method is called, theSetviewreturned by this method will be invalidated, and will throwIllegalStateExceptionif it is accessed in any way, with the following exceptions:- view.equals(view)evaluates to- true(but any other- equals()expression involving- viewwill throw)
- hashCode()does not throw
- if nodeis re-added to the network after having been removed,view's behavior is undefined
 
- 
edgesConnectingDescription copied from interface:NetworkReturns a live view of the set of edges that each directly connectnodeUtonodeV.In an undirected network, this is equal to edgesConnecting(nodeV, nodeU).The resulting set of edges will be parallel (i.e. have equal Network.incidentNodes(Object)). If this network does notallow parallel edges, the resulting set will contain at most one edge (equivalent toedgeConnecting(nodeU, nodeV).asSet()).If either nodeUornodeVare removed from the network after this method is called, theSetviewreturned by this method will be invalidated, and will throwIllegalStateExceptionif it is accessed in any way, with the following exceptions:- view.equals(view)evaluates to- true(but any other- equals()expression involving- viewwill throw)
- hashCode()does not throw
- if nodeUornodeVare re-added to the network after having been removed,view's behavior is undefined
 - Specified by:
- edgesConnectingin interface- Network<N,- E> 
- Overrides:
- edgesConnectingin class- AbstractNetwork<N,- E> 
 
- 
inEdgesDescription copied from interface:NetworkReturns a live view of all edges in this network which can be traversed in the direction (if any) of the edge to end atnode.In a directed network, an incoming edge's EndpointPair.target()equalsnode.In an undirected network, this is equivalent to Network.incidentEdges(Object).If nodeis removed from the network after this method is called, theSetviewreturned by this method will be invalidated, and will throwIllegalStateExceptionif it is accessed in any way, with the following exceptions:- view.equals(view)evaluates to- true(but any other- equals()expression involving- viewwill throw)
- hashCode()does not throw
- if nodeis re-added to the network after having been removed,view's behavior is undefined
 
- 
outEdgesDescription copied from interface:NetworkReturns a live view of all edges in this network which can be traversed in the direction (if any) of the edge starting fromnode.In a directed network, an outgoing edge's EndpointPair.source()equalsnode.In an undirected network, this is equivalent to Network.incidentEdges(Object).If nodeis removed from the network after this method is called, theSetviewreturned by this method will be invalidated, and will throwIllegalStateExceptionif it is accessed in any way, with the following exceptions:- view.equals(view)evaluates to- true(but any other- equals()expression involving- viewwill throw)
- hashCode()does not throw
- if nodeis re-added to the network after having been removed,view's behavior is undefined
 
- 
predecessorsDescription copied from interface:NetworkReturns a live view of all nodes in this network adjacent tonodewhich can be reached by traversingnode's incoming edges against the direction (if any) of the edge.In an undirected network, this is equivalent to Network.adjacentNodes(Object).If nodeis removed from the network after this method is called, theSetreturned by this method will be invalidated, and will throwIllegalStateExceptionif it is accessed in any way.
- 
successorsDescription copied from interface:NetworkReturns a live view of all nodes in this network adjacent tonodewhich can be reached by traversingnode's outgoing edges in the direction (if any) of the edge.In an undirected network, this is equivalent to Network.adjacentNodes(Object).This is not the same as "all nodes reachable from nodeby following outgoing edges". For that functionality, seeGraphs.reachableNodes(Graph, Object).If nodeis removed from the network after this method is called, theSetviewreturned by this method will be invalidated, and will throwIllegalStateExceptionif it is accessed in any way, with the following exceptions:- view.equals(view)evaluates to- true(but any other- equals()expression involving- viewwill throw)
- hashCode()does not throw
- if nodeis re-added to the network after having been removed,view's behavior is undefined
 
 
-