Package edu.uci.ics.jung.graph
Class AbstractTypedGraph<V,E>
java.lang.Object
edu.uci.ics.jung.graph.AbstractGraph<V,E>
edu.uci.ics.jung.graph.AbstractTypedGraph<V,E>
- All Implemented Interfaces:
Graph<V,
,E> Hypergraph<V,
,E> Serializable
- Direct Known Subclasses:
DirectedSparseGraph
,DirectedSparseMultigraph
,OrderedKAryTree
,UndirectedSparseGraph
,UndirectedSparseMultigraph
An abstract class for graphs whose edges all have the same
EdgeType
.
Intended to simplify the implementation of such graph classes.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTypedGraph
(EdgeType edge_type) Creates an instance with the specified edge type. -
Method Summary
Modifier and TypeMethodDescriptionReturns this graph's edge type.int
getEdgeCount
(EdgeType edge_type) Returns the edge count for this graph ifedge_type
matches the edge type for this graph, and 0 otherwise.Returns the edge set for this graph ifedgeType
matches the edge type for this graph, and an empty set otherwise.getEdgeType
(E e) Returns this graph's edge type, ornull
ife
is not in this graph.protected boolean
hasEqualEdgeType
(EdgeType edge_type) protected void
validateEdgeType
(EdgeType edge_type) Throws anIllegalArgumentException
ifedge_type
does not match the default edge type for this graph.Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph
addEdge, addEdge, addEdge, addEdge, addEdge, addEdge, degree, findEdge, findEdgeSet, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.uci.ics.jung.graph.Graph
getDest, getEndpoints, getInEdges, getOutEdges, getPredecessors, getSource, getSuccessors, isDest, isSource
Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph
addVertex, containsEdge, containsVertex, getEdgeCount, getEdges, getIncidentEdges, getNeighbors, getVertexCount, getVertices, removeEdge, removeVertex
-
Field Details
-
edge_type
The edge type for all edges in this graph.
-
-
Constructor Details
-
AbstractTypedGraph
Creates an instance with the specified edge type.- Parameters:
edge_type
- the type of edges that this graph accepts
-
-
Method Details
-
getDefaultEdgeType
Returns this graph's edge type.- Returns:
- the default edge type for this graph
-
getEdgeType
Returns this graph's edge type, ornull
ife
is not in this graph.- Parameters:
e
- the edge whose type is to be returned- Returns:
- the
EdgeType
ofedge
, ornull
ifedge
has no defined type
-
getEdges
Returns the edge set for this graph ifedgeType
matches the edge type for this graph, and an empty set otherwise.- Parameters:
edge_type
- the type of edges to be returned- Returns:
- the collection of edges which are of type
edge_type
, ornull
if the graph does not accept edges of this type - See Also:
-
getEdgeCount
Returns the edge count for this graph ifedge_type
matches the edge type for this graph, and 0 otherwise.- Parameters:
edge_type
- the type of edge for which the count is to be returned- Returns:
- the number of edges of type
edge_type
in this graph
-
hasEqualEdgeType
- Parameters:
edge_type
- the edge type to compare to this instance's default edge type- Returns:
true
ifedge_type
matches the default edge type for this graph, andfalse
otherwise
-
validateEdgeType
Throws anIllegalArgumentException
ifedge_type
does not match the default edge type for this graph.- Parameters:
edge_type
- the edge type to compare to this instance's default edge type
-