ValueGraph that supports the options supplied by AbstractGraphBuilder.
This class maintains a map of nodes to GraphConnections.
Collection-returning accessors return unmodifiable views: the view returned will reflect changes to the graph (if the graph is mutable) but may not be modified by the user.
The time complexity of all collection-returning accessors is O(1), since views are returned.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| pack-priv long | |
| private final boolean | |
| pack-priv final MapIteratorCache | |
| private final ElementOrder |
| Access | Constructor and Description |
|---|---|
| pack-priv | StandardValueGraph(AbstractGraphBuilder<? super N> builder)
Constructs a graph with the properties specified in |
| pack-priv | StandardValueGraph(AbstractGraphBuilder<? super N> builder, Map<N, GraphConnections<N, V>> nodeConnections, long edgeCount)
Constructs a graph with the properties specified in |
| Modifier and Type | Method and Description |
|---|---|
| public Set | adjacentNodes(N node)
Implements com. node in this graph.
|
| public boolean | allowsSelfLoops()
Implements com. |
| private final GraphConnections | |
| pack-priv final boolean | |
| protected long | edgeCount()
Overrides com. Graph#edges().
|
| public V | edgeValueOrDefault(N nodeU, N nodeV, V defaultValue)
Implements com. nodeU to nodeV, if one is present;
otherwise, returns defaultValue.
|
| public V | edgeValueOrDefault(EndpointPair<N> endpoints, V defaultValue)
Implements com. endpoints (in the order, if any, specified
by endpoints), if one is present; otherwise, returns defaultValue.
|
| private final V | |
| public boolean | hasEdgeConnecting(N nodeU, N nodeV)
Overrides com. Implements com. nodeU to nodeV.
|
| public boolean | hasEdgeConnecting(EndpointPair<N> endpoints)
Overrides com. Implements com. endpoints (in the order, if
any, specified by endpoints).
|
| private final boolean | |
| public Set | incidentEdges(N node)
Overrides com. Implements com. node.
|
| public boolean | isDirected()
Implements com. |
| public ElementOrder | nodeOrder()
Implements com. nodes().
|
| public Set | nodes()
Implements com. nodeOrder().
|
| public Set | predecessors(N node)
Implements com. node which can be reached by traversing
node's incoming edges against the direction (if any) of the edge.
|
| public Set | successors(N node)
Implements com. node which can be reached by traversing
node's outgoing edges in the direction (if any) of the edge.
|
| allowsSelfLoops | back to summary |
|---|---|
| private final boolean allowsSelfLoops | |
| edgeCount | back to summary |
|---|---|
| pack-priv long edgeCount | |
| isDirected | back to summary |
|---|---|
| private final boolean isDirected | |
| nodeConnections | back to summary |
|---|---|
| pack-priv final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections | |
| nodeOrder | back to summary |
|---|---|
| private final ElementOrder<N> nodeOrder | |
| StandardValueGraph | back to summary |
|---|---|
| pack-priv StandardValueGraph(AbstractGraphBuilder<? super N> builder) Constructs a graph with the properties specified in | |
| StandardValueGraph | back to summary |
|---|---|
| pack-priv StandardValueGraph(AbstractGraphBuilder<? super N> builder, Map<N, GraphConnections<N, V>> nodeConnections, long edgeCount) Constructs a graph with the properties specified in | |
| adjacentNodes | back to summary |
|---|---|
| public Set Implements com. Doc from com. Returns the nodes which have an incident edge in common with This is equal to the union of
| |
| allowsSelfLoops | back to summary |
|---|---|
| public boolean allowsSelfLoops() Implements com. Doc from com. Returns true if this graph allows self-loops (edges that connect a node to itself). Attempting
to add a self-loop to a graph that does not allow them will throw an
| |
| checkedConnections | back to summary |
|---|---|
| private final GraphConnections | |
| containsNode | back to summary |
|---|---|
| pack-priv final boolean containsNode(N node) | |
| edgeCount | back to summary |
|---|---|
| protected long edgeCount() Overrides com. Doc from com. Returns the number of edges in this graph; used to calculate the size of
| |
| edgeValueOrDefault | back to summary |
|---|---|
| public V edgeValueOrDefault(N nodeU, N nodeV, V defaultValue) Implements com. Doc from com. Returns the value of the edge that connects In an undirected graph, this is equal to
| |
| edgeValueOrDefault | back to summary |
|---|---|
| public V edgeValueOrDefault(EndpointPair<N> endpoints, V defaultValue) Implements com. Doc from com. Returns the value of the edge that connects If this graph is directed, the endpoints must be ordered.
| |
| edgeValueOrDefaultInternal | back to summary |
|---|---|
private final V edgeValueOrDefaultInternal(N nodeU, N nodeV, V defaultValue)
| |
| hasEdgeConnecting | back to summary |
|---|---|
| public boolean hasEdgeConnecting(N nodeU, N nodeV) Overrides com. Implements com. Doc from com. Returns true if there is an edge that directly connects In an undirected graph, this is equal to
| |
| hasEdgeConnecting | back to summary |
|---|---|
| public boolean hasEdgeConnecting(EndpointPair<N> endpoints) Overrides com. Implements com. Doc from com. Returns true if there is an edge that directly connects Unlike the other
| |
| hasEdgeConnectingInternal | back to summary |
|---|---|
| private final boolean hasEdgeConnectingInternal(N nodeU, N nodeV) | |
| incidentEdges | back to summary |
|---|---|
| public Set Overrides com. Implements com. Doc from com. Returns the edges in this graph whose endpoints include This is equal to the union of incoming and outgoing edges.
| |
| isDirected | back to summary |
|---|---|
| public boolean isDirected() Implements com. Doc from com. Returns true if the edges in this graph are directed. Directed edges connect a
| |
| nodeOrder | back to summary |
|---|---|
| public ElementOrder Implements com. Doc from com. Returns the order of iteration for the elements of
| |
| nodes | back to summary |
|---|---|
| public Set Implements com. Doc from com. Returns all nodes in this graph, in the order specified by
| |
| predecessors | back to summary |
|---|---|
| public Set Implements com. Doc from com. Returns all nodes in this graph adjacent to In an undirected graph, this is equivalent to
| |
| successors | back to summary |
|---|---|
| public Set Implements com. Doc from com. Returns all nodes in this graph adjacent to In an undirected graph, this is equivalent to This is not the same as "all nodes reachable from
| |