Package com.google.common.graph
Class ImmutableNetwork<N,E>
- java.lang.Object
-
- com.google.common.graph.AbstractNetwork<N,E>
-
- com.google.common.graph.ConfigurableNetwork<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>
@Beta public final class ImmutableNetwork<N,E> extends ConfigurableNetwork<N,E>
ANetwork
whose 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
-
-
Field Summary
-
Fields inherited from class com.google.common.graph.ConfigurableNetwork
edgeToReferenceNode, nodeConnections
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ImmutableNetwork(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.ConfigurableNetwork
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, edgeConnectingOrNull, equals, hasEdgeConnecting, hashCode, inDegree, outDegree, toString
-
-
-
-
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:Network
Returns a live view of this network as aGraph
. The resultingGraph
will have an edge connecting node A to node B if thisNetwork
has 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 theGraph
view 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)
-
-