Class GraphsUtils


  • public class GraphsUtils
    extends Object
    Static methods class for graphs.
    Author:
    Barak Ugav
    • Method Detail

      • containsSelfEdges

        public static <V,​E> boolean containsSelfEdges​(Graph<V,​E> g)
        Check whether a graph contain self edges.

        A self edge is an edge whose source and target is the same vertex.

        Type Parameters:
        V - the vertices type
        E - the edges type
        Parameters:
        g - a graph
        Returns:
        true if the graph contain at least one self edge, else false
      • containsParallelEdges

        public static <V,​E> boolean containsParallelEdges​(Graph<V,​E> g)
        Check whether a graph contain parallel edges.

        Two parallel edges are edges that have the same source and target vertices.

        Type Parameters:
        V - the vertices type
        E - the edges type
        Parameters:
        g - a graph
        Returns:
        true if the graph contain at least one pair of parallel edges, else false