40#define forall_adj_elements(adj, ge) for ((adj) = (v)->firstAdj(); (adj); (adj) = (adj)->succ())
43#define forall_hypernodes(v, H) for ((v) = (H).firstHypernode(); (v); (v) = (v)->succ())
46#define forall_rev_hypernodes(v, H) for ((v) = (H).lastHypernode(); (v); (v) = (v)->pred())
49#define forall_hyperedges(e, H) for ((e) = (H).firstHyperedge(); (e); (e) = (e)->succ())
52#define forall_rev_hyperedges(e, H) for ((e) = (H).lastHyperedge(); (e); (e) = (e)->pred())
77 friend class GraphListBase;
106 int index()
const {
return m_index; }
114 GraphElement*
element()
const {
return m_element; }
137 friend class GraphListBase;
158 : m_index(
pIndex), m_cardinality(0), m_hypergraph(
nullptr) { }
162 int index()
const {
return m_index; }
180 template<
class NODELIST>
184 hypernodes.pushBack(
reinterpret_cast<hypernode>(adj->element()));
191 if (
reinterpret_cast<hypernode>(adj->element()) == v) {
217 friend class GraphListBase;
263 int index()
const {
return m_index; }
284 template<
class NODELIST>
288 hyperedges.pushBack(
reinterpret_cast<hyperedge>(adj->element()));
364 bool empty()
const {
return m_nHypernodes == 0; }
Decralation of GraphElement and GraphList classes.
Declaration of doubly linked lists and iterators.
Class for adjacency list elements.
GraphElement * m_element
The associated hyperedge or hypernode.
adjHypergraphEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
adjHypergraphEntry succ() const
Returns the successor in the adjacency list.
int index() const
Returns the index of this adjacency element.
adjHypergraphEntry twin() const
Returns the pointer to a twin adjacency list.
adjHypergraphEntry m_twin
The corresponding adjacency entry.
int m_index
The (unique) index of the adjacency entry.
adjHypergraphEntry pred() const
Returns the predecessor in the adjacency list.
adjHypergraphEntry cyclicPred() const
Returns the cyclic predecessor in the adjacency list.
AdjHypergraphElement(GraphElement *pElement, int pIndex)
Constructs an adjacency entry for a given hyper{node,edge} and index.
GraphElement * element() const
Returns the element associated with this adjacency entry.
AdjHypergraphElement(GraphElement *pElement)
Constructs an adjacency element for a given hyper{node,edge}.
Dynamic arrays indexed with nodes.
Class for the representation of hyperedges.
internal::GraphList< AdjHypergraphElement > m_adjHypernodes
The adjacency list of the hyperedge.
void allHypernodes(NODELIST &hypernodes) const
Returns a list with all incident hypernodes of the hyperedge.
Hypergraph * hypergraph() const
Returns the hypergraph containing the hyperedge.
adjHypergraphEntry lastAdj() const
Returns the last entry in the adjacency list.
int cardinality() const
Returns the number of incident hypernodes.
hyperedge pred() const
Returns the predecessor in the list of all hyperedges.
int m_cardinality
The number of incidend hypernodes.
bool incident(hypernode v) const
Returns true iff v is incident to the hyperedge.
friend std::ostream & operator<<(std::ostream &os, ogdf::hyperedge e)
internal::GraphList< AdjHypergraphElement > incidentHypernodes() const
Returns the incident hypernodes of the hyperedge.
hyperedge succ() const
Returns the successor in the list of all hyperedges.
Hypergraph * m_hypergraph
The hypergraph containing the hyperedge (if any).
adjHypergraphEntry firstAdj() const
Returns the first entry in the adjaceny list.
bool operator==(const hyperedge e) const
Equality operator.
int index() const
Returns the index of a hyperedge.
int m_index
The (unique) index of the hyperedge.
HyperedgeElement(int pIndex)
Constructs an hyperedge element between hypernodes.
Abstract base class for hypergraph arrays.
void unregisterHypernodeArray(ListIterator< HypergraphArrayBase * > it) const
Unregisters a hypernode array.
void delHyperedge(hyperedge e)
Removes hyperedge e from the hypergraph.
void loadPlaHypergraph(const char *fileName)
Reads hypergraph in pla format from the file.
hyperedge lastHyperEdge() const
Returns the last hyperedge in the list of all hyperedges.
ListIterator< HypergraphArrayBase * > registerHypernodeArray(HypergraphArrayBase *pHypernodeArray) const
Registers a node array.
ListPure< HypergraphObserver * > m_observers
int hypernodeArrayTableSize() const
Returns the table size of hypernode arrays with the hypergraph.
hyperedge randomHyperedge() const
Returns a randomly chosen hyperedge.
internal::GraphList< HypernodeElement > hypernodes() const
Returns the list of all hypernodes.
void clear()
Removes all hypernodes and all hyperedges from the hypergraph.
hyperedge firstHyperedge() const
Returns the first hyperedge in the list of all hyperedges.
int maxHyperedgeIndex() const
Returns the largest used hyperedge index.
hypernode newHypernode(int pIndex, HypernodeElement::Type pType)
Creates a new hypernode with given pIndex and pType and returns it.
int m_hyperedgeIdCount
The Index that will be assigned to the next created hyperedge.
int m_hypernodeIdCount
The Index that will be assigned to the next created hypernode.
internal::GraphList< HyperedgeElement > m_hyperedges
The list of all hyperedges.
void unregisterHyperedgeArray(ListIterator< HypergraphArrayBase * > it) const
Unregisters an hyperedge array.
int m_nHypernodes
The number of hypernodes in the hypergraph.
ListPure< HypergraphArrayBase * > m_hyperedgeArrays
void allHyperedges(LIST &hyperedgeList) const
Returns a list with all hyperedges of the hypergraph.
int m_hyperedgeArrayTableSize
The current table size of hyperedge arrays within the hypergraph.
bool empty() const
Returns true iff the hypergraph is empty (ie. contains no hypernodes).
hypernode newHypernode(HypernodeElement::Type pType)
Creates a new hypernode with given pType and returns it.
int numberOfHyperedges() const
Returns the number of hyperedges in the hypergraph.
internal::GraphList< HypernodeElement > m_hypernodes
The list of all hypernodes.
friend std::istream & operator>>(std::istream &is, ogdf::Hypergraph &H)
int m_hypernodeArrayTableSize
The current table size of hypernode arrays within the hypergraph.
void readBenchHypergraph(std::istream &is)
Reads hypergraph in bench format from the input stream.
bool consistency() const
Checks the consistency of the data structure.
Hypergraph & operator=(const Hypergraph &H)
friend std::ostream & operator<<(std::ostream &os, ogdf::Hypergraph &H)
Hypergraph(const Hypergraph &H)
Constructs a hypergraph that is a copy of H.
hypernode lastHypernode() const
Returns the last hypernode in the list of all hypernodes.
int nextEntry(char *buffer, int from, string stop)
void allHypernodes(LIST &hypernodeList) const
Returns a list with all hypernodes of the hypergraph.
hypernode newHypernode()
Creates a new hypernode and returns it.
int maxHypernodeIndex() const
Returns the largest used hypernode index.
int numberOfHypernodes() const
Returns the number of hypernodes in the hypergraph.
HypernodeElement::Type gateType(string gate)
ListIterator< HypergraphArrayBase * > registerHyperedgeArray(HypergraphArrayBase *pHyperedgeArray) const
hyperedge newHyperedge(int pIndex, List< hypernode > &hypernodes)
Creates a new hyperedge between hypernodes and returns it.
void readPlaHypergraph(std::istream &is)
Reads hypergraph in pla format from the input stream.
void readBenchHypergraph(const char *filename)
Reads hypergraph in bench format from the file.
hypernode firstHypernode() const
Returns the first hypernode in the list of all hypernodes.
ListPure< HypergraphArrayBase * > m_hypernodeArrays
The registered hypergraph arrays & observers.
Hypergraph()
Constructs an empty hypergraph.
internal::GraphList< HyperedgeElement > hyperedges() const
Returns the list of all hyperedges.
void delHypernode(hypernode v)
Removes hypernode v and all incident hyperedges from the hypergraph.
hyperedge newHyperedge(List< hypernode > &hypernodes)
Creates a new hyperedge btween hypernodes and returns it.
hypernode randomHypernode() const
Returns a randomly chosen hypergraph.
int hyperedgeArrayTableSize() const
Returns the table size of hyperedge arrays within the hypergraph.
hypernode newHypernode(int pIndex)
Creates a new hypernode with given pIndex and returns it.
int m_nHyperedges
The number of hyperedges in the hypergraph.
ListIterator< HypergraphObserver * > registerObserver(HypergraphObserver *pObserver) const
Registers a hypergraph observer (e.g. a EdgeStandardRep).
void unregisterObserver(ListIterator< HypergraphObserver * > it) const
Unregisters a hypergraph observer.
Dynamic arrays indexed with hypernodes.
Class for the representation of hypernodes.
HypernodeElement(int pIndex, Type pType)
Constructor.
int index() const
Returns the (unique) hypernode index.
void type(Type pType)
Sets the type of hypernode.
int m_degree
The number of incident hyperedges.
int m_index
The (unique) index of the hypernode.
hypernode pred() const
Returns the predecessor in the list of all hypernodes.
hypernode succ() const
Returns the successor in the list of all hypernodes.
Type m_type
The type of the hypernode.
adjHypergraphEntry lastAdj() const
Returns the last entry in the adjacency list.
HypernodeElement(int pIndex)
Constructor.
adjHypergraphEntry firstAdj() const
Returns the first entry in the adjaceny list.
Hypergraph * hypergraph() const
Returns the hypergraph containing the hypernode.
void allHyperedges(NODELIST &hyperedges) const
Returns a list with all incident hyperedges of the hypernode.
Type type() const
Returns the type of hypernode.
bool adjacent(hypernode v) const
Returns true iff v is adjacent to the hypernode.
internal::GraphList< AdjHypergraphElement > m_adjHyperedges
The adjacency list of the hypernode.
int degree() const
Returns the hypernode degree.
Hypergraph * m_hypergraph
The hypergraph containing the hypernode (if any).
Type
The type of hypernodes.
bool operator==(const hypernode v) const
Equality operator.
Doubly linked lists (maintaining the length of the list).
Encapsulates a pointer to a list element.
The base class for objects used by (hyper)graphs.
Lists of graph objects (like nodes, edges, etc.).
T * head() const
Returns the first element in the list.
T * tail() const
Returns the last element in the list.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.