Package org.onlab.graph
Class MutableAdjacencyListsGraph<V extends Vertex,E extends Edge<V>>
- java.lang.Object
-
- org.onlab.graph.MutableAdjacencyListsGraph<V,E>
-
- All Implemented Interfaces:
Graph<V,E>
,MutableGraph<V,E>
public class MutableAdjacencyListsGraph<V extends Vertex,E extends Edge<V>> extends java.lang.Object implements MutableGraph<V,E>
-
-
Constructor Summary
Constructors Constructor Description MutableAdjacencyListsGraph(java.util.Set<V> vertex, java.util.Set<E> edge)
Creates a graph comprising of the specified vertexes and edges.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdge(E edge)
Adds the specified edge to this graph.void
addVertex(V vertex)
Adds the specified vertex to this graph.void
clear()
Clear the graph.boolean
equals(java.lang.Object obj)
java.util.Set<E>
getEdges()
Returns the set of edges comprising the graph.java.util.Set<E>
getEdgesFrom(V src)
Returns all edges leading out from the specified source vertex.java.util.Set<E>
getEdgesTo(V dst)
Returns all edges leading towards the specified destination vertex.java.util.Set<V>
getVertexes()
Returns the set of vertexes comprising the graph.int
hashCode()
void
removeEdge(E edge)
Removes the specified edge from the graph.void
removeVertex(V vertex)
Removes the specified vertex from the graph.Graph<V,E>
toImmutable()
Returns an immutable copy of this graph.java.lang.String
toString()
-
-
-
Method Detail
-
getVertexes
public java.util.Set<V> getVertexes()
Description copied from interface:Graph
Returns the set of vertexes comprising the graph.
-
getEdges
public java.util.Set<E> getEdges()
Description copied from interface:Graph
Returns the set of edges comprising the graph.
-
getEdgesFrom
public java.util.Set<E> getEdgesFrom(V src)
Description copied from interface:Graph
Returns all edges leading out from the specified source vertex.
-
getEdgesTo
public java.util.Set<E> getEdgesTo(V dst)
Description copied from interface:Graph
Returns all edges leading towards the specified destination vertex.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
addVertex
public void addVertex(V vertex)
Description copied from interface:MutableGraph
Adds the specified vertex to this graph.
-
removeVertex
public void removeVertex(V vertex)
Description copied from interface:MutableGraph
Removes the specified vertex from the graph.- Specified by:
removeVertex
in interfaceMutableGraph<V extends Vertex,E extends Edge<V>>
- Parameters:
vertex
- vertex to be removed
-
addEdge
public void addEdge(E edge)
Description copied from interface:MutableGraph
Adds the specified edge to this graph. If the edge vertexes are not already in the graph, they will be added as well.
-
removeEdge
public void removeEdge(E edge)
Description copied from interface:MutableGraph
Removes the specified edge from the graph.- Specified by:
removeEdge
in interfaceMutableGraph<V extends Vertex,E extends Edge<V>>
- Parameters:
edge
- edge to be removed
-
toImmutable
public Graph<V,E> toImmutable()
Description copied from interface:MutableGraph
Returns an immutable copy of this graph.- Specified by:
toImmutable
in interfaceMutableGraph<V extends Vertex,E extends Edge<V>>
- Returns:
- immutable copy
-
clear
public void clear()
Clear the graph.
-
-