Class MutableAdjacencyListsGraph<V extends Vertex,​E extends Edge<V>>

    • Constructor Detail

      • MutableAdjacencyListsGraph

        public MutableAdjacencyListsGraph​(Set<V> vertex,
                                          Set<E> edge)
        Creates a graph comprising of the specified vertexes and edges.
        Parameters:
        vertex - set of graph vertexes
        edge - set of graph edges
    • Method Detail

      • getVertexes

        public Set<V> getVertexes()
        Description copied from interface: Graph
        Returns the set of vertexes comprising the graph.
        Specified by:
        getVertexes in interface Graph<V extends Vertex,​E extends Edge<V>>
        Returns:
        set of vertexes
      • getEdges

        public Set<E> getEdges()
        Description copied from interface: Graph
        Returns the set of edges comprising the graph.
        Specified by:
        getEdges in interface Graph<V extends Vertex,​E extends Edge<V>>
        Returns:
        set of edges
      • getEdgesFrom

        public Set<E> getEdgesFrom​(V src)
        Description copied from interface: Graph
        Returns all edges leading out from the specified source vertex.
        Specified by:
        getEdgesFrom in interface Graph<V extends Vertex,​E extends Edge<V>>
        Parameters:
        src - source vertex
        Returns:
        set of egress edges; empty if no such edges
      • getEdgesTo

        public Set<E> getEdgesTo​(V dst)
        Description copied from interface: Graph
        Returns all edges leading towards the specified destination vertex.
        Specified by:
        getEdgesTo in interface Graph<V extends Vertex,​E extends Edge<V>>
        Parameters:
        dst - destination vertex
        Returns:
        set of ingress vertexes; empty if no such edges
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • addVertex

        public void addVertex​(V vertex)
        Description copied from interface: MutableGraph
        Adds the specified vertex to this graph.
        Specified by:
        addVertex in interface MutableGraph<V extends Vertex,​E extends Edge<V>>
        Parameters:
        vertex - new vertex
      • removeVertex

        public void removeVertex​(V vertex)
        Description copied from interface: MutableGraph
        Removes the specified vertex from the graph.
        Specified by:
        removeVertex in interface MutableGraph<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.
        Specified by:
        addEdge in interface MutableGraph<V extends Vertex,​E extends Edge<V>>
        Parameters:
        edge - new edge
      • removeEdge

        public void removeEdge​(E edge)
        Description copied from interface: MutableGraph
        Removes the specified edge from the graph.
        Specified by:
        removeEdge in interface MutableGraph<V extends Vertex,​E extends Edge<V>>
        Parameters:
        edge - edge to be removed
      • clear

        public void clear()
        Clear the graph.