Class SimpleSDGraph<N,​E>

    • Constructor Detail

      • SimpleSDGraph

        public SimpleSDGraph()
        Конструктор
      • SimpleSDGraph

        public SimpleSDGraph​(GraphFactory<N,​E> factory)
        Конструктор
        Parameters:
        factory - Фабрика графа
    • Method Detail

      • getNodes

        public Eterable<N> getNodes()
        Description copied from interface: Graph
        Возвращает вершины графа
        Specified by:
        getNodes in interface Graph<N,​E>
        Returns:
        вершины
      • getEdges

        public Eterable<Edge<N,​E>> getEdges()
        Description copied from interface: Graph
        Возвращает Ребра и вершины графа
        Specified by:
        getEdges in interface Graph<N,​E>
        Returns:
        Ребра и вершины
      • getEdges

        public List<E> getEdges​(N a,
                                N b)
        Description copied from interface: Graph
        Возвращает ребра между вершинами
        Specified by:
        getEdges in interface Graph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б
        Returns:
        Ребра
      • edgesOf

        public Collection<Edge<N,​E>> edgesOf​(N node)
        Description copied from interface: Graph
        Возвращает ребра указанной вершины
        Specified by:
        edgesOf in interface Graph<N,​E>
        Parameters:
        node - Вершина
        Returns:
        ребра
      • edgesOfNodeA

        public Collection<Edge<N,​E>> edgesOfNodeA​(N node)
        Description copied from interface: Graph
        Возвращает ребра из вершины А
        Specified by:
        edgesOfNodeA in interface Graph<N,​E>
        Parameters:
        node - Вершина А
        Returns:
        Ребра
      • edgesOfNodeB

        public Collection<Edge<N,​E>> edgesOfNodeB​(N node)
        Description copied from interface: Graph
        Возвращает ребра из вершины Б
        Specified by:
        edgesOfNodeB in interface Graph<N,​E>
        Parameters:
        node - Вершина Б
        Returns:
        Ребра
      • hasEdge

        public boolean hasEdge​(N a,
                               N b)
        Description copied from interface: Graph
        Проверка наличия ребра между вершинами
        Specified by:
        hasEdge in interface Graph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б
        Returns:
        Флаг наличия ребра
      • getEdge

        public E getEdge​(N a,
                         N b)
        Description copied from interface: Graph
        Возвращает ребро между вершинами
        Specified by:
        getEdge in interface Graph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б
        Returns:
        Ребро
      • contains

        public boolean contains​(N node)
        Description copied from interface: Graph
        Проверяет наличае вершины
        Specified by:
        contains in interface Graph<N,​E>
        Parameters:
        node - Вершина
        Returns:
        true -вершина содержиться в графе
      • indexOf

        protected int indexOf​(N node)
        Возвращает индекс вершины в списке вершин
        Parameters:
        node - Вершина
        Returns:
        индекс или -1 если таковой нет в списке
      • onNodeRemoved

        protected void onNodeRemoved​(N node)
        Срабатывает при удалении вершины из графа
        Parameters:
        node - Вершина
      • onEdgeRemoved

        protected void onEdgeRemoved​(Edge<N,​E> es)
        Срабатывает при удалении ребра из графа
        Parameters:
        es - Ребро
      • onNodeAdded

        protected void onNodeAdded​(N node)
        Срабатывает при добавлении вершины в граф
        Parameters:
        node - Вершина
      • onEdgeAdded

        protected void onEdgeAdded​(Edge<N,​E> es)
        Срабатывает при добавлении ребра в граф
        Parameters:
        es - Ребро
      • remove

        protected void remove​(Edge<N,​E> es)
        Удаление ребра
        Parameters:
        es - Ребро
      • add

        protected void add​(Edge<N,​E> es)
        Добавление ребра
        Parameters:
        es - Ребро
      • add

        public void add​(N node)
        Description copied from interface: Graph
        Добавляет вершину к графу
        Specified by:
        add in interface Graph<N,​E>
        Parameters:
        node - Вершина
      • remove

        public void remove​(N node)
        Description copied from interface: Graph
        Удаляет вершину из графа
        Specified by:
        remove in interface Graph<N,​E>
        Parameters:
        node - Вершина
      • clearEdges

        public void clearEdges()
        Description copied from interface: Graph
        Удаляет все ребра
        Specified by:
        clearEdges in interface Graph<N,​E>
      • clearAll

        public void clearAll()
        Description copied from interface: Graph
        Удалес все ребра и вершины
        Specified by:
        clearAll in interface Graph<N,​E>
      • get

        public E get​(N a,
                     N b)
        Description copied from interface: SingleGraph
        Возвращает ребро между вершинами
        Specified by:
        get in interface SingleGraph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б
        Returns:
        Ребро
      • set

        public void set​(N a,
                        N b,
                        E e)
        Description copied from interface: SingleGraph
        Устанавливает/Сбрасывает ребро между вершинами
        Specified by:
        set in interface SingleGraph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б
        e - Ребро
      • setEdge

        public void setEdge​(N a,
                            N b,
                            E edge)
        Description copied from interface: Graph
        Установка ребра между вершинами
        Specified by:
        setEdge in interface Graph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б
        edge - Ребро
      • setEdges

        public void setEdges​(N a,
                             N b,
                             Iterable<E> edges)
        Description copied from interface: Graph
        Установка ребр между вершинами
        Specified by:
        setEdges in interface Graph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б
        edges - Ребра
      • removeEdge

        public void removeEdge​(N a,
                               N b)
        Description copied from interface: Graph
        Удаление ребра
        Specified by:
        removeEdge in interface Graph<N,​E>
        Parameters:
        a - Вершина А
        b - Вершина Б