N
- The class representing the nodes of the graphE
- The class representing the edges of the graphpublic class DirectedGraph<N,E> extends AbstractGraph<N,E>
Constructor and Description |
---|
DirectedGraph()
Instantiates a new empty directed graph.
|
DirectedGraph(Graph<? extends N,? extends E> graph)
Instantiates a new directed graph, with node and edge data copied from
the given graph.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(N node)
Add a node to the graph.
|
boolean |
addEdge(E edge,
N orig,
N dest)
Add the edge element to the graph.
|
E |
getEdge(N n1,
N n2)
Get the edge between two nodes.
|
prajna.util.DirectedGraph.Segment<N,E> |
getEdgeSegment(E edge)
Get the edge segment for the specified edge.
|
java.util.Set<E> |
getEdgeSet()
Get the set of edges for this graph.
|
java.util.Set<N> |
getNodeSet()
Get the set of nodes for this graph.
|
java.util.Set<Graph.Segment<N,E>> |
getSegmentSet()
Get the set of edge segments for this graph.
|
boolean |
isDirected()
Returns whether this graph is directed
|
java.lang.String |
toString()
Return a string representation of this graph
|
addAll, clear, contains, containsEdge, edgeIterator, equals, getNodeEdges, hashCode, isEmpty, iterator, order, remove, removeEdge, size
public boolean add(N node)
node
- the node to addpublic boolean addEdge(E edge, N orig, N dest)
edge
- the edge to addorig
- the origin nodedest
- the destination nodepublic E getEdge(N n1, N n2)
n1
- The first noden2
- The second nodepublic prajna.util.DirectedGraph.Segment<N,E> getEdgeSegment(E edge)
edge
- the edgepublic java.util.Set<E> getEdgeSet()
public java.util.Set<N> getNodeSet()
public java.util.Set<Graph.Segment<N,E>> getSegmentSet()
public boolean isDirected()
isDirected
in interface Graph<N,E>
isDirected
in class AbstractGraph<N,E>
public java.lang.String toString()
toString
in class java.lang.Object