com.kuka.graph
Class Graphs

java.lang.Object
  extended by com.kuka.graph.Graphs

public final class Graphs
extends Object

Contains helper methods for working with graphs.


Method Summary
static
<N,E> boolean
addGraph(Graph<N,E> destination, Graph<N,E> source)
          Adds all nodes and edges in the source graph to the destination graph if they are not already present.
static
<N,E> Graph<N,E>
emptyGraph()
          Returns the empty graph (immutable).
static
<N,E> Path<N,E>
emptyPath()
          Returns the empty path (immutable).
static
<N,E> Graph<N,E>
unmodifiableGraph(Graph<N,E> graph)
          Returns an unmodifiable view of the specified graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addGraph

public static <N,E> boolean addGraph(Graph<N,E> destination,
                                     Graph<N,E> source)
Adds all nodes and edges in the source graph to the destination graph if they are not already present.

Type Parameters:
N - the type of nodes
E - the type of edges
Parameters:
destination - the destination graph
source - the source graph
Returns:
true if the destination graph changed as a result of the call

unmodifiableGraph

public static <N,E> Graph<N,E> unmodifiableGraph(Graph<N,E> graph)
Returns an unmodifiable view of the specified graph. This method allows modules to provide users with "read-only" access to internal graphs. Query operations on the returned graph "read through" to the specified graph, and attempts to modify the returned graph, whether direct or via its iterator, result in an UnsupportedOperationException.

The returned graph will be serializable if the specified collection is serializable.

Type Parameters:
N - the type of nodes
E - the type of edges
Parameters:
graph - the graph for which an unmodifiable view is to be returned
Returns:
an unmodifiable view of the specified graph.

emptyGraph

public static <N,E> Graph<N,E> emptyGraph()
Returns the empty graph (immutable).

Type Parameters:
N - the type of nodes
E - the type of edges
Returns:
the empty graph (immutable)

emptyPath

public static <N,E> Path<N,E> emptyPath()
Returns the empty path (immutable).

Type Parameters:
N - the type of nodes
E - the type of edges
Returns:
the empty path (immutable)


Copyright © 2019. All rights reserved.