N
 Node parameter typeE
 Edge parameter type@Beta @Immutable(containerOf={"N","E"}) public final class ImmutableNetwork<N,E> extends AbstractNetwork<N,E>
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.
Modifier and Type  Class and Description 

static class 
ImmutableNetwork.Builder<N,E>
A builder for creating
ImmutableNetwork instances, especially static final
networks. 
Modifier and Type  Field and Description 

protected com.google.common.graph.MapIteratorCache<E,N> 
edgeToReferenceNode 
protected com.google.common.graph.MapIteratorCache<N,com.google.common.graph.NetworkConnections<N,E>> 
nodeConnections 
Modifier and Type  Method and Description 

Set<N> 
adjacentNodes(N node)
Returns the nodes which have an incident edge in common with
node in this network. 
boolean 
allowsParallelEdges()
Returns true if this network allows parallel edges.

boolean 
allowsSelfLoops()
Returns true if this network allows selfloops (edges that connect a node to itself).

ImmutableGraph<N> 
asGraph()
Returns a live view of this network as a
Graph . 
protected com.google.common.graph.NetworkConnections<N,E> 
checkedConnections(N node) 
protected N 
checkedReferenceNode(E edge) 
protected boolean 
containsEdge(E edge) 
protected boolean 
containsNode(N node) 
static <N,E> ImmutableNetwork<N,E> 
copyOf(ImmutableNetwork<N,E> network)
Deprecated.
no need to use this

static <N,E> ImmutableNetwork<N,E> 
copyOf(Network<N,E> network)
Returns an immutable copy of
network . 
ElementOrder<E> 
edgeOrder()
Returns the order of iteration for the elements of
Network.edges() . 
Set<E> 
edges()
Returns all edges in this network, in the order specified by
Network.edgeOrder() . 
Set<E> 
edgesConnecting(N nodeU,
N nodeV)
Returns the set of edges that each directly connect
nodeU to nodeV . 
Set<E> 
incidentEdges(N node)
Returns the edges whose
incident nodes in this network include
node . 
EndpointPair<N> 
incidentNodes(E edge)
Returns the nodes which are the endpoints of
edge in this network. 
Set<E> 
inEdges(N node)
Returns all edges in this network which can be traversed in the direction (if any) of the edge
to end at
node . 
boolean 
isDirected()
Returns true if the edges in this network are directed.

ElementOrder<N> 
nodeOrder()
Returns the order of iteration for the elements of
Network.nodes() . 
Set<N> 
nodes()
Returns all nodes in this network, in the order specified by
Network.nodeOrder() . 
Set<E> 
outEdges(N node)
Returns all edges in this network which can be traversed in the direction (if any) of the edge
starting from
node . 
Set<N> 
predecessors(N node)
Returns all nodes in this network adjacent to
node which can be reached by traversing
node 's incoming edges against the direction (if any) of the edge. 
Set<N> 
successors(N node)
Returns all nodes in this network adjacent to
node which can be reached by traversing
node 's outgoing edges in the direction (if any) of the edge. 
adjacentEdges, degree, edgeConnecting, edgeConnecting, edgeConnectingOrNull, edgeConnectingOrNull, edgesConnecting, equals, hasEdgeConnecting, hasEdgeConnecting, hashCode, inDegree, isOrderingCompatible, outDegree, toString, validateEndpoints
protected final com.google.common.graph.MapIteratorCache<N,com.google.common.graph.NetworkConnections<N,E>> nodeConnections
protected final com.google.common.graph.MapIteratorCache<E,N> edgeToReferenceNode
public static <N,E> ImmutableNetwork<N,E> copyOf(Network<N,E> network)
network
.@Deprecated public static <N,E> ImmutableNetwork<N,E> copyOf(ImmutableNetwork<N,E> network)
public ImmutableGraph<N> asGraph()
Network
Graph
. The resulting Graph
will have
an edge connecting node A to node B if this Network
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, the Network.degree(Object)
of a node
in the Graph
view may be less than the degree of the same node in this Network
.
public Set<N> nodes()
Network
Network.nodeOrder()
.public Set<E> edges()
Network
Network.edgeOrder()
.public boolean isDirected()
Network
source node
to a target node
, while
undirected edges connect a pair of nodes to each other.public boolean allowsParallelEdges()
Network
IllegalArgumentException
.public boolean allowsSelfLoops()
Network
IllegalArgumentException
.public ElementOrder<N> nodeOrder()
Network
Network.nodes()
.public ElementOrder<E> edgeOrder()
Network
Network.edges()
.public Set<E> incidentEdges(N node)
Network
incident nodes
in this network include
node
.
This is equal to the union of Network.inEdges(Object)
and Network.outEdges(Object)
.
public EndpointPair<N> incidentNodes(E edge)
Network
edge
in this network.public Set<N> adjacentNodes(N node)
Network
node
in this network.
This is equal to the union of Network.predecessors(Object)
and Network.successors(Object)
.
public Set<E> edgesConnecting(N nodeU, N nodeV)
Network
nodeU
to nodeV
.
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 not allow parallel edges
, the resulting set
will contain at most one edge (equivalent to edgeConnecting(nodeU, nodeV).asSet()
).
edgesConnecting
in interface Network<N,E>
edgesConnecting
in class AbstractNetwork<N,E>
public Set<E> inEdges(N node)
Network
node
.
In a directed network, an incoming edge's EndpointPair.target()
equals node
.
In an undirected network, this is equivalent to Network.incidentEdges(Object)
.
public Set<E> outEdges(N node)
Network
node
.
In a directed network, an outgoing edge's EndpointPair.source()
equals node
.
In an undirected network, this is equivalent to Network.incidentEdges(Object)
.
public Set<N> predecessors(N node)
Network
node
which can be reached by traversing
node
's incoming edges against the direction (if any) of the edge.
In an undirected network, this is equivalent to Network.adjacentNodes(Object)
.
public Set<N> successors(N node)
Network
node
which can be reached by traversing
node
'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 node
by following outgoing
edges". For that functionality, see Graphs.reachableNodes(Graph, Object)
.
protected final com.google.common.graph.NetworkConnections<N,E> checkedConnections(N node)
protected final N checkedReferenceNode(E edge)
protected final boolean containsNode(N node)
protected final boolean containsEdge(E edge)
Copyright © 2010–2019. All rights reserved.