Class ImmutableNetwork<N,E>
- Type Parameters:
N
- Node parameter typeE
- Edge parameter type
- All Implemented Interfaces:
Network<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.
- Since:
- 20.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionadjacentNodes
(Object node) Returns the nodes which have an incident edge in common withnode
in this network.boolean
Returns true if this network allows parallel edges.boolean
Returns true if this network allows self-loops (edges that connect a node to itself).asGraph()
Returns a live view of this network as aGraph
.checkedConnections
(Object node) protected final N
checkedReferenceNode
(Object edge) protected final boolean
containsEdge
(Object edge) protected final boolean
containsNode
(Object node) 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
(Object nodeU, Object nodeV) Returns the set of edges directly connectingnodeU
tonodeV
.incidentEdges
(Object node) Returns the edges whoseincident nodes
in this network includenode
.incidentNodes
(Object edge) Returns the nodes which are the endpoints ofedge
in this network.Returns all edges in this network which can be traversed in the direction (if any) of the edge to end atnode
.boolean
Returns 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 all edges in this network which can be traversed in the direction (if any) of the edge starting fromnode
.predecessors
(Object node) Returns all nodes in this network adjacent tonode
which can be reached by traversingnode
's incoming edges against the direction (if any) of the edge.successors
(Object node) Returns all nodes in this network adjacent tonode
which can be reached by traversingnode
's outgoing edges in the direction (if any) of the edge.Methods inherited from class com.google.common.graph.AbstractNetwork
adjacentEdges, degree, inDegree, outDegree, toString
-
Field Details
-
nodeConnections
-
edgeToReferenceNode
-
-
Method Details
-
copyOf
Returns an immutable copy ofnetwork
. -
copyOf
Deprecated.no need to use thisSimply returns its argument. -
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
. -
nodes
Description copied from interface:Network
Returns all nodes in this network, in the order specified byNetwork.nodeOrder()
. -
edges
Description copied from interface:Network
Returns all edges in this network, in the order specified byNetwork.edgeOrder()
. -
isDirected
public boolean isDirected()Description copied from interface:Network
Returns true if the edges in this network are directed. Directed edges connect asource node
to atarget node
, while undirected edges connect a pair of nodes to each other. -
allowsParallelEdges
public boolean allowsParallelEdges()Description copied from interface:Network
Returns true if this network allows parallel edges. Attempting to add a parallel edge to a network that does not allow them will throw anUnsupportedOperationException
. -
allowsSelfLoops
public boolean allowsSelfLoops()Description copied from interface:Network
Returns 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 anUnsupportedOperationException
. -
nodeOrder
Description copied from interface:Network
Returns the order of iteration for the elements ofNetwork.nodes()
. -
edgeOrder
Description copied from interface:Network
Returns the order of iteration for the elements ofNetwork.edges()
. -
incidentEdges
Description copied from interface:Network
Returns the edges whoseincident nodes
in this network includenode
. -
incidentNodes
Description copied from interface:Network
Returns the nodes which are the endpoints ofedge
in this network. -
adjacentNodes
Description copied from interface:Network
Returns the nodes which have an incident edge in common withnode
in this network. -
edgesConnecting
Description copied from interface:Network
Returns the set of edges directly connectingnodeU
tonodeV
.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. -
inEdges
Description copied from interface:Network
Returns 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)
. -
outEdges
Description copied from interface:Network
Returns 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)
. -
predecessors
Description copied from interface:Network
Returns all nodes in this network adjacent tonode
which 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)
. -
successors
Description copied from interface:Network
Returns all nodes in this network adjacent tonode
which 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
node
by following outgoing edges". For that functionality, seeGraphs.reachableNodes(Graph, Object)
. -
checkedConnections
-
checkedReferenceNode
-
containsNode
-
containsEdge
-