Module logicng

Class Hypergraph<T>

  • Type Parameters:
    T - the content type of the graph's nodes

    public final class Hypergraph<T>
    extends Object
    A simple data structure for a hypergraph.
    Since:
    1.4.0
    Version:
    2.0.0
    • Constructor Detail

      • Hypergraph

        public Hypergraph()
        Constructs a new hypergraph.
    • Method Detail

      • nodes

        public Set<HypergraphNode<T>> nodes()
        Returns the set of nodes of the hypergraph.
        Returns:
        the set of nodes of the hypergraph
      • edges

        public Set<HypergraphEdge<T>> edges()
        Returns the set of edges of the hypergraph.
        Returns:
        the set of edges of the hypergraph
      • addEdge

        public void addEdge​(HypergraphEdge<T> edge)
        Adds an edge to the hypergraph.
        Parameters:
        edge - the edge
      • addEdge

        public void addEdge​(Collection<HypergraphNode<T>> nodes)
        Adds an edges to the hypergraph. The edge is represented by its connected nodes.
        Parameters:
        nodes - the nodes of the edge
      • addEdge

        @SafeVarargs
        public final void addEdge​(HypergraphNode<T>... nodes)
        Adds an edges to the hypergraph. The edge is represented by its connected nodes.
        Parameters:
        nodes - the nodes of the edge
      • addEdges

        public void addEdges​(Collection<HypergraphEdge<T>> edges)
        Adds a set of edges to the hypergraph.
        Parameters:
        edges - the edges