Class Neighbors


  • public final class Neighbors
    extends Object
    Utilities for extracting neighborhood graphs and iterating over them.
    • Method Detail

      • neighborIterator

        public static <V,​E> Iterator<V> neighborIterator​(org.jgrapht.Graph<V,​E> graph,
                                                               V node)
        Create an iterator over the neighbors of the given node.
        Type Parameters:
        V - the type of nodes in the graph
        E - the type of edges in the graph
        Parameters:
        graph - the graph
        node - the target node
        Returns:
        an iterator
      • neighborSetOf

        public static <V,​E> Set<V> neighborSetOf​(org.jgrapht.Graph<V,​E> graph,
                                                       V node)
        Extract the neighbors of the given node.
        Type Parameters:
        V - the type of nodes in the graph
        E - the type of edges in the graph
        Parameters:
        graph - the graph
        node - the target node
        Returns:
        a set
      • neighborhoodGraph

        public static <V,​E> org.jgrapht.Graph<V,​E> neighborhoodGraph​(org.jgrapht.Graph<V,​E> graph,
                                                                                 V node)
        Create an iterator over the neighbors of the given node.
        Type Parameters:
        V - the type of nodes in the graph
        E - the type of edges in the graph
        Parameters:
        graph - the graph
        node - the target node
        Returns:
        a neighborhood of node