public interface DirectedGraph<E extends DirectedEdge> extends Graph<E>
Modifier and Type | Method and Description |
---|---|
DirectedGraph<E> |
copy(Set<Integer> vertices)
Creates a copy of this graph containing only the specified number of
vertices and all edges between those vertices.
|
Set<E> |
getEdges(int vertex1,
int vertex2)
Returns the
Edge instances connecting the two vertices or an
empty set if the vertices are not connected. |
int |
inDegree(int vertex)
Returns the number of directed edges where
vertex is the head of
the edge, i.e. |
Set<E> |
inEdges(int vertex)
Returns the set of directed edges where
vertex is the head of the
edge |
int |
outDegree(int vertex)
Returns the number of directed edges where
vertex is the tail of
the edge, i.e. |
Set<E> |
outEdges(int vertex)
Returns the set of directed edges where
vertex is the tail of the
edge, i.e. |
IntSet |
predecessors(int vertex)
Returns the set of vertices that point to this vertex.
|
DirectedGraph<E> |
subgraph(Set<Integer> vertices)
Returns a view of this graph containing only the specified vertices where
the returned graph's vertinces are renamed (0, ..., n).
|
IntSet |
successors(int vertex)
Returns the set of vertices that can be reached by following the outgoing
edges from this vertex.
|
DirectedGraph<E> copy(Set<Integer> vertices)
vertices
is
empty a new, empty graph of this instance's type is returned. Any
changes made to this graph will not be reflected in returned copy or
vice-versa.copy
in interface Graph<E extends DirectedEdge>
Set<E> getEdges(int vertex1, int vertex2)
Edge
instances connecting the two vertices or an
empty set if the vertices are not connected. If the two vertices have bidirectional edges, this set will
include two edges.getEdges
in interface Graph<E extends DirectedEdge>
int inDegree(int vertex)
vertex
is the head of
the edge, i.e. the edge points to vertex
.Set<E> inEdges(int vertex)
vertex
is the head of the
edgeint outDegree(int vertex)
vertex
is the tail of
the edge, i.e. the edge originates at vertex
Set<E> outEdges(int vertex)
vertex
is the tail of the
edge, i.e. the edge originates at vertex
IntSet predecessors(int vertex)
IntSet successors(int vertex)
DirectedGraph<E> subgraph(Set<Integer> vertices)
Only edges connecting two vertices in the provided set will be viewable in the subgraph. Any changes to the subgraph will be reflected in this graph and vice versa.
This view allows for direct manipulation of a part of the graph. For example, clearing this subgraph will remove all of its corresponding vertices and edges from the backing graph.
subgraph
in interface Graph<E extends DirectedEdge>
vertices
- the vertices to include in the subgraphCopyright © 2012. All Rights Reserved.