Class SetHypergraph<V,​H>

  • All Implemented Interfaces:
    edu.uci.ics.jung.graph.Hypergraph<V,​H>, edu.uci.ics.jung.graph.MultiGraph<V,​H>, java.io.Serializable

    public class SetHypergraph<V,​H>
    extends java.lang.Object
    implements edu.uci.ics.jung.graph.Hypergraph<V,​H>, edu.uci.ics.jung.graph.MultiGraph<V,​H>, java.io.Serializable
    An implementation of Hypergraph that is suitable for sparse graphs and permits parallel edges.
    See Also:
    Serialized Form
    • Field Detail

      • vertices

        protected java.util.Map<V,​java.util.Set<H>> vertices
      • edges

        protected java.util.Map<H,​java.util.Set<V>> edges
    • Constructor Detail

      • SetHypergraph

        public SetHypergraph()
        Creates a SetHypergraph and initializes the internal data structures.
    • Method Detail

      • getFactory

        public static <V,​H> org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.Hypergraph<V,​H>> getFactory()
        Returns a Factory which creates instances of this class.
        Type Parameters:
        V - vertex type of the hypergraph to be created
        H - edge type of the hypergraph to be created
        Returns:
        a Factory which creates instances of this class
      • addEdge

        public boolean addEdge​(H hyperedge,
                               java.util.Collection<? extends V> to_attach)
        Adds hyperedge to this graph and connects them to the vertex collection to_attach. Any vertices in to_attach that appear more than once will only appear once in the incident vertex collection for hyperedge, that is, duplicates will be ignored.
        Specified by:
        addEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
        See Also:
        Hypergraph.addEdge(Object, Collection)
      • addEdge

        public boolean addEdge​(H hyperedge,
                               java.util.Collection<? extends V> to_attach,
                               edu.uci.ics.jung.graph.util.EdgeType edge_type)
        Specified by:
        addEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
        See Also:
        Hypergraph.addEdge(Object, Collection, EdgeType)
      • getEdgeType

        public edu.uci.ics.jung.graph.util.EdgeType getEdgeType​(H edge)
        Specified by:
        getEdgeType in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
        See Also:
        Hypergraph.getEdgeType(Object)
      • containsVertex

        public boolean containsVertex​(V vertex)
        Specified by:
        containsVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • containsEdge

        public boolean containsEdge​(H edge)
        Specified by:
        containsEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getEdges

        public java.util.Collection<H> getEdges()
        Specified by:
        getEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getVertices

        public java.util.Collection<V> getVertices()
        Specified by:
        getVertices in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getEdgeCount

        public int getEdgeCount()
        Specified by:
        getEdgeCount in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getVertexCount

        public int getVertexCount()
        Specified by:
        getVertexCount in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getNeighbors

        public java.util.Collection<V> getNeighbors​(V vertex)
        Specified by:
        getNeighbors in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getIncidentEdges

        public java.util.Collection<H> getIncidentEdges​(V vertex)
        Specified by:
        getIncidentEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getIncidentVertices

        public java.util.Collection<V> getIncidentVertices​(H edge)
        Specified by:
        getIncidentVertices in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • findEdge

        public H findEdge​(V v1,
                          V v2)
        Specified by:
        findEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • findEdgeSet

        public java.util.Collection<H> findEdgeSet​(V v1,
                                                   V v2)
        Specified by:
        findEdgeSet in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • addVertex

        public boolean addVertex​(V vertex)
        Specified by:
        addVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • removeVertex

        public boolean removeVertex​(V vertex)
        Specified by:
        removeVertex in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • removeEdge

        public boolean removeEdge​(H hyperedge)
        Specified by:
        removeEdge in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • isNeighbor

        public boolean isNeighbor​(V v1,
                                  V v2)
        Specified by:
        isNeighbor in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • isIncident

        public boolean isIncident​(V vertex,
                                  H edge)
        Specified by:
        isIncident in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • degree

        public int degree​(V vertex)
        Specified by:
        degree in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getNeighborCount

        public int getNeighborCount​(V vertex)
        Specified by:
        getNeighborCount in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getIncidentCount

        public int getIncidentCount​(H edge)
        Specified by:
        getIncidentCount in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getEdgeCount

        public int getEdgeCount​(edu.uci.ics.jung.graph.util.EdgeType edge_type)
        Specified by:
        getEdgeCount in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getEdges

        public java.util.Collection<H> getEdges​(edu.uci.ics.jung.graph.util.EdgeType edge_type)
        Specified by:
        getEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getDefaultEdgeType

        public edu.uci.ics.jung.graph.util.EdgeType getDefaultEdgeType()
        Specified by:
        getDefaultEdgeType in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getInEdges

        public java.util.Collection<H> getInEdges​(V vertex)
        Specified by:
        getInEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getOutEdges

        public java.util.Collection<H> getOutEdges​(V vertex)
        Specified by:
        getOutEdges in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • inDegree

        public int inDegree​(V vertex)
        Specified by:
        inDegree in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • outDegree

        public int outDegree​(V vertex)
        Specified by:
        outDegree in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getDest

        public V getDest​(H directed_edge)
        Specified by:
        getDest in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getSource

        public V getSource​(H directed_edge)
        Specified by:
        getSource in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getPredecessors

        public java.util.Collection<V> getPredecessors​(V vertex)
        Specified by:
        getPredecessors in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>
      • getSuccessors

        public java.util.Collection<V> getSuccessors​(V vertex)
        Specified by:
        getSuccessors in interface edu.uci.ics.jung.graph.Hypergraph<V,​H>