com.kuka.graph
Interface Path<N,E>

Type Parameters:
N - the type of nodes contained in this path
E - the type of the edges contained in the path
All Superinterfaces:
Graph<N,E>, Iterable<N>
All Known Implementing Classes:
BasePath, FastUncheckedPath

public interface Path<N,E>
extends Graph<N,E>

Represents a path in a graph G=(N,E). A path is a sequence of edges in E which connect a sequence of nodes which are all distinct from one another. All edges are directed in the same direction.


Method Summary
 Path<N,E> concat(Path<N,E> other)
          Concatenates the specified path to the end of this path.
 N firstNode()
          Returns the first node of this path.
 N lastNode()
          Returns the last node of this path.
 boolean removeFirstNode()
          Removes the first node (and edge to second node) from this path (optional operation).
 boolean removeLastNode()
          Removes the last node (and edge to last node) from this path (optional operation).
 
Methods inherited from interface com.kuka.graph.Graph
addAllEdges, addAllNodes, addEdge, addNode, clear, containsAllEdges, containsAllNodes, containsEdge, containsEdge, containsNode, createEdge, createNode, edges, edges, edgeSize, getEdge, incomingEdges, isEmpty, neighbors, nodes, nodes, nodeSize, outgoingEdges, removeAllEdges, removeAllNodes, removeEdge, removeEdge, removeNode, retainAllEdges, retainAllNodes
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

firstNode

N firstNode()
Returns the first node of this path.

Returns:
the first node

lastNode

N lastNode()
Returns the last node of this path.

Returns:
the last node

removeFirstNode

boolean removeFirstNode()
Removes the first node (and edge to second node) from this path (optional operation).

Returns true if this path is not empty (or equivalently, if this path changed as a result of the call).

Returns:
true if the first node was removed from the path
Throws:
UnsupportedOperationException - if the removeNode operation is not supported by this path

removeLastNode

boolean removeLastNode()
Removes the last node (and edge to last node) from this path (optional operation).

Returns true if this path is not empty (or equivalently, if this path changed as a result of the call).

Returns:
true if the last node was removed from the path
Throws:
UnsupportedOperationException - if the removeNode operation is not supported by this path

concat

Path<N,E> concat(Path<N,E> other)
Concatenates the specified path to the end of this path.

If the length of the specified path is 0, then this path is returned. Otherwise the elements of the specified are only added to the end of this path if the target node of the last element of this path is equal to the source node of the first element of the specified path.

Parameters:
other - the path to be concatenated to the end of this path
Returns:
this path


Copyright © 2019. All rights reserved.