|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.graph.impl.AbstractGraph<N,E>
com.kuka.graph.impl.FastUncheckedGraph<N,E>
N - the type of nodesE - the type of edgespublic class FastUncheckedGraph<N,E extends Edge<N>>
Implements a graph as incidence map. This graph is designed to allow for fast and efficient querying of and access to outgoing edges and neighbors of nodes. No guarantees about efficiency regarding access to incoming edges and predecessors of nodes are given. If a graph also providing efficiency for these operations is needed a different implementation should be used or the corresponding methods should be overriden correspondingly.
| Constructor Summary | |
|---|---|
FastUncheckedGraph(NodeFactory<N> nodeFactory,
EdgeFactory<N,E> edgeFactory)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
addEdge(E edge)
Adds the specified edge to this graph if it is not already present (optional operation). |
boolean |
addNode(N node)
Adds the specified node to this graph if it is not already present (optional operation). |
boolean |
containsEdge(E edge)
Returns true if this graph contains the specified edge. |
boolean |
containsNode(N node)
Returns true if this graph contains the specified node. |
E |
createEdge(N source,
N target)
Creates a new edge from the specified source node to the target node, adds it to this graph and returns the created edge. |
N |
createNode()
Creates a new node, adds it to this graph and returns the created node. |
Set<E> |
edges()
Returns an unmodifiable Set view of the edges contained in this graph. |
E |
getEdge(N source,
N target)
Returns the edge e=(source,target) from the specified source node to the target node, or null if this graph contains no such edge. |
Set<E> |
incomingEdges(N node)
Returns the set of all incoming edges of the specified node. |
Set<N> |
neighbors(N node)
Returns the set of all neighbors of the specified node. |
Set<N> |
nodes()
Returns an unmodifiable Set view of the nodes contained in this graph. |
Set<E> |
outgoingEdges(N node)
Returns the set of all outgoing edges of the specified node. |
boolean |
removeEdge(E edge)
Removes the specified edge e from this graph if it is present (optional operation). |
boolean |
removeNode(N node)
Removes the specified node n from this graph if it is present (optional operation). |
| Methods inherited from class com.kuka.graph.impl.AbstractGraph |
|---|
addAllEdges, addAllNodes, clear, containsAllEdges, containsAllNodes, containsEdge, edges, edgeSize, isEmpty, iterator, nodes, nodeSize, removeAllEdges, removeAllNodes, removeEdge, retainAllEdges, retainAllNodes, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FastUncheckedGraph(NodeFactory<N> nodeFactory,
EdgeFactory<N,E> edgeFactory)
nodeFactory - the node factory to be set.edgeFactory - the edge factory to be set.| Method Detail |
|---|
public boolean containsNode(N node)
Graph
node - node whose presence in this graph is to be tested
public boolean containsEdge(E edge)
Graph
edge - edge whose presence in this graph is to be tested
public Set<N> nodes()
GraphSet view of the nodes contained in this graph. The set is backed by the graph, so
changes to the graph are reflected in the set. If the graph is modified while an iteration over the set is in
progress, the results of the iteration are undefined.
public Set<E> edges()
GraphSet view of the edges contained in this graph. The set is backed by the graph, so
changes to the graph are reflected in the set. If the graph is modified while an iteration over the set is in
progress, the results of the iteration are undefined.
public E getEdge(N source,
N target)
GraphMore formally, if this graph contains an edge e* such that e.equals(e*), where e=(source,target), then this method returns e*, otherwise it returns null.
source - the source node of the edge that is to be returnedtarget - the target node of the edge that is to be returned
public Set<E> outgoingEdges(N node)
GraphMore formally, this method returns all edges e in this graph such that the given node is the source node of e, i.e. e=(node,*).
node - the source node
public Set<E> incomingEdges(N node)
GraphMore formally, this method returns all edges e in this graph such that the given node is the target node of e, i.e. e=(*,node).
node - the target node
public Set<N> neighbors(N node)
Graph
node - the node of which all neighboring nodes are to be returned
public N createNode()
Graph
public E createEdge(N source,
N target)
Graph
source - the source node of the edge that is to be createdtarget - the target node of the edge that is to be created
public boolean addNode(N node)
GraphMore formally, adds the specified node n to this graph if the graph contains no element n2 such that n.equals(n2)) . If this graph already contains the element, the call leaves the graph unchanged and returns false.
node - node to be added to this graph
public boolean addEdge(E edge)
GraphMore formally, adds the specified edge e to this graph if the graph contains no element e2 such that e.equals(e2)) . If this graph already contains the element, the call leaves the graph unchanged and returns false.
edge - edge to be added to this graph
public boolean removeNode(N node)
GraphMore formally, removes a node n* such that n.equals(n*) , if this graph contains such a node. Furthermore, all edges incident to this node are removed. Returns true if this graph contained the node (or equivalently, if this graph changed as a result of the call).
node - node to be removed from this graph, if present
public boolean removeEdge(E edge)
GraphMore formally, removes an edge e* such that e.equals(e*), if this graph contains such an edge. Returns true if this graph contained the edge (or equivalently, if this graph changed as a result of the call).
edge - edge to be removed from this graph, if present
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||