Package com.google.common.graph
Class ImmutableGraph<N>
- java.lang.Object
-
- com.google.common.graph.AbstractBaseGraph<N>
-
- com.google.common.graph.AbstractGraph<N>
-
- com.google.common.graph.ForwardingGraph<N>
-
- com.google.common.graph.ImmutableGraph<N>
-
- Type Parameters:
N
- Node parameter type
- All Implemented Interfaces:
BaseGraph<N>
,Graph<N>
,PredecessorsFunction<N>
,SuccessorsFunction<N>
public class ImmutableGraph<N> extends ForwardingGraph<N>
AGraph
whose elements and structural relationships will never change. Instances of this class may be obtained withcopyOf(Graph)
.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 class
ImmutableGraph.Builder<N>
A builder for creatingImmutableGraph
instances, especiallystatic final
graphs.
-
Field Summary
Fields Modifier and Type Field Description private BaseGraph<N>
backingGraph
-
Constructor Summary
Constructors Constructor Description ImmutableGraph(BaseGraph<N> backingGraph)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private static <N> GraphConnections<N,GraphConstants.Presence>
connectionsOf(Graph<N> graph, N node)
static <N> ImmutableGraph<N>
copyOf(Graph<N> graph)
Returns an immutable copy ofgraph
.static <N> ImmutableGraph<N>
copyOf(ImmutableGraph<N> graph)
Deprecated.no need to use thisprotected BaseGraph<N>
delegate()
private static <N> ImmutableMap<N,GraphConnections<N,GraphConstants.Presence>>
getNodeConnections(Graph<N> graph)
ElementOrder<N>
incidentEdgeOrder()
Returns anElementOrder
that specifies the order of iteration for the elements ofBaseGraph.edges()
,BaseGraph.adjacentNodes(Object)
,BaseGraph.predecessors(Object)
,BaseGraph.successors(Object)
andBaseGraph.incidentEdges(Object)
.-
Methods inherited from class com.google.common.graph.ForwardingGraph
adjacentNodes, allowsSelfLoops, degree, edgeCount, hasEdgeConnecting, hasEdgeConnecting, incidentEdges, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successors
-
Methods inherited from class com.google.common.graph.AbstractGraph
equals, hashCode, toString
-
Methods inherited from class com.google.common.graph.AbstractBaseGraph
edges, isOrderingCompatible, validateEndpoints
-
-
-
-
Method Detail
-
copyOf
public static <N> ImmutableGraph<N> copyOf(Graph<N> graph)
Returns an immutable copy ofgraph
.
-
copyOf
@Deprecated public static <N> ImmutableGraph<N> copyOf(ImmutableGraph<N> graph)
Deprecated.no need to use thisSimply returns its argument.
-
incidentEdgeOrder
public ElementOrder<N> incidentEdgeOrder()
Description copied from interface:BaseGraph
Returns anElementOrder
that specifies the order of iteration for the elements ofBaseGraph.edges()
,BaseGraph.adjacentNodes(Object)
,BaseGraph.predecessors(Object)
,BaseGraph.successors(Object)
andBaseGraph.incidentEdges(Object)
.- Specified by:
incidentEdgeOrder
in interfaceBaseGraph<N>
- Specified by:
incidentEdgeOrder
in interfaceGraph<N>
- Overrides:
incidentEdgeOrder
in classForwardingGraph<N>
-
getNodeConnections
private static <N> ImmutableMap<N,GraphConnections<N,GraphConstants.Presence>> getNodeConnections(Graph<N> graph)
-
connectionsOf
private static <N> GraphConnections<N,GraphConstants.Presence> connectionsOf(Graph<N> graph, N node)
-
delegate
protected BaseGraph<N> delegate()
- Specified by:
delegate
in classForwardingGraph<N>
-
-