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 Hypergraph;
78 friend class GraphListBase;
100 : m_element(pElement)
105 : m_element(pElement), m_index(pIndex)
158 friend class Hypergraph;
159 friend class GraphListBase;
181 : m_index(pIndex), m_cardinality(0), m_hypergraph(nullptr) { }
194 return m_cardinality;
206 return m_adjHypernodes.
head();
212 return m_adjHypernodes.
tail();
218 return m_adjHypernodes;
226 hypernodes.pushBack(reinterpret_cast<hypernode>(adj->element()));
233 if (reinterpret_cast<hypernode>(adj->element()) == v) {
267 friend class Hypergraph;
268 friend class GraphListBase;
308 : m_index(pIndex), m_degree(0), m_type(
Type::normal), m_hypergraph(nullptr)
314 : m_index(pIndex), m_degree(0), m_type(pType), m_hypergraph(nullptr)
353 return m_adjHyperedges.
head();
359 return m_adjHyperedges.
tail();
367 hyperedges.pushBack(reinterpret_cast<hyperedge>(adj->element()));
374 if (reinterpret_cast<hyperedge>(adj->element())->incident(v)) {
445 Hypergraph(
const Hypergraph &
H);
453 return m_nHypernodes == 0;
471 return m_nHypernodes;
477 return m_nHyperedges;
483 return m_hypernodeIdCount - 1;
489 return m_hyperedgeIdCount - 1;
495 return m_hypernodes.
head();
501 return m_hypernodes.
tail();
507 return m_hyperedges.
head();
513 return m_hyperedges.
tail();
519 return m_hypernodeArrayTableSize;
525 return m_hyperedgeArrayTableSize;
579 hypernodeList.clear();
581 hypernodeList.pushBack(v);
587 hyperedgeList.clear();
589 hyperedgeList.pushBack(e);
593 void readBenchHypergraph(istream &is);
596 void readBenchHypergraph(
const char *filename);
599 void readPlaHypergraph(istream &is);
602 void loadPlaHypergraph(
const char *fileName);
605 bool consistency()
const;
627 Hypergraph &operator=(
const Hypergraph &
H);
639 void initObservers();
641 int nextEntry(
char *buffer,
int from,
string stop);
Hypergraph * m_hypergraph
The hypergraph containing the hyperedge (if any).
int m_hypernodeArrayTableSize
The current table size of hypernode arrays within the hypergraph.
internal::GraphList< AdjHypergraphElement > incidentHypernodes() const
Returns the incident hypernodes of the hyperedge.
bool adjacent(hypernode v) const
Returns true iff v is adjacent to the hypernode.
internal::GraphList< HypernodeElement > m_hypernodes
The list of all hypernodes.
hypernode firstHypernode() const
Returns the first hypernode in the list of all hypernodes.
adjHypergraphEntry twin() const
Returns the pointer to a twin adjacency list.
int index() const
Returns the (unique) hypernode index.
Type type() const
Returns the type of hypernode.
void allHyperedges(NODELIST &hyperedges) const
Returns a list with all incident hyperedges of the hypernode.
adjHypergraphEntry lastAdj() const
Returns the last entry in the adjacency list.
void allHypernodes(NODELIST &hypernodes) const
Returns a list with all incident hypernodes of the hyperedge.
ListPure< HypergraphObserver * > m_observers
GraphElement * element() const
Returns the element associated with this adjacency entry.
static std::istream & operator>>(std::istream &inStream, HyperGraph::NodeArray< T > &array)
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
HypernodeElement(int pIndex, Type pType)
Constructor.
int m_cardinality
The number of incidend hypernodes.
void allHypernodes(LIST &hypernodeList) const
Returns a list with all hypernodes of the hypergraph.
hyperedge lastHyperEdge() const
Returns the last hyperedge in the list of all hyperedges.
hyperedge pred() const
Returns the predecessor in the list of all hyperedges.
hypernode succ() const
Returns the successor in the list of all hypernodes.
int index() const
Returns the index of a hyperedge.
Hypergraph * m_hypergraph
The hypergraph containing the hypernode (if any).
adjHypergraphEntry succ() const
Returns the successor in the adjacency list.
Class for adjacency list elements.
T * tail() const
Returns the last element in the list.
internal::GraphList< HypernodeElement > hypernodes() const
Returns the list of all hypernodes.
ostream & operator<<(ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Decralation of GraphElement and GraphList classes.
int m_hypernodeIdCount
The Index that will be assigned to the next created hypernode.
internal::GraphList< HyperedgeElement > hyperedges() const
Returns the list of all hyperedges.
ListPure< HypergraphArrayBase * > m_hypernodeArrays
The registered hypergraph arrays & observers.
int maxHypernodeIndex() const
Returns the largest used hypernode index.
int degree() const
Returns the hypernode degree.
int hyperedgeArrayTableSize() const
Returns the table size of hyperedge arrays within the hypergraph.
AdjHypergraphElement(GraphElement *pElement, int pIndex)
Constructs an adjacency entry for a given hyper{node,edge} and index.
adjHypergraphEntry lastAdj() const
Returns the last entry in the adjacency list.
AdjHypergraphElement(GraphElement *pElement)
Constructs an adjacency element for a given hyper{node,edge}.
Type m_type
The type of the hypernode.
int numberOfHypernodes() const
Returns the number of hypernodes in the hypergraph.
T * head() const
Returns the first element in the list.
hypernode lastHypernode() const
Returns the last hypernode in the list of all hypernodes.
Doubly linked lists (maintaining the length of the list).
int m_hyperedgeIdCount
The Index that will be assigned to the next created hyperedge.
int hypernodeArrayTableSize() const
Returns the table size of hypernode arrays with the hypergraph.
Class for the representation of hypernodes.
hyperedge firstHyperedge() const
Returns the first hyperedge in the list of all hyperedges.
HypernodeElement(int pIndex)
Constructor.
bool operator==(const hyperedge e) const
Equality operator.
int m_index
The (unique) index of the hyperedge.
int m_degree
The number of incident hyperedges.
The base class for objects used by (hyper)graphs.
void type(Type pType)
Sets the type of hypernode.
adjHypergraphEntry firstAdj() const
Returns the first entry in the adjaceny list.
Encapsulates a pointer to a list element.
internal::GraphList< AdjHypergraphElement > m_adjHyperedges
The adjacency list of the hypernode.
bool incident(hypernode v) const
Returns true iff v is incident to the hyperedge.
Hypergraph * hypergraph() const
Returns the hypergraph containing the hypernode.
int m_nHypernodes
The number of hypernodes in the hypergraph.
bool empty() const
Returns true iff the hypergraph is empty (ie. contains no hypernodes).
ListPure< HypergraphArrayBase * > m_hyperedgeArrays
void allHyperedges(LIST &hyperedgeList) const
Returns a list with all hyperedges of the hypergraph.
adjHypergraphEntry m_twin
The corresponding adjacency entry.
int m_nHyperedges
The number of hyperedges in the hypergraph.
internal::GraphList< HyperedgeElement > m_hyperedges
The list of all hyperedges.
bool operator==(const hypernode v) const
Equality operator.
int m_index
The (unique) index of the hypernode.
int m_hyperedgeArrayTableSize
The current table size of hyperedge arrays within the hypergraph.
int numberOfHyperedges() const
Returns the number of hyperedges in the hypergraph.
Abstract base class for hypergraph arrays.
adjHypergraphEntry pred() const
Returns the predecessor in the adjacency list.
HyperedgeElement(int pIndex)
Constructs an hyperedge element between hypernodes.
hypernode pred() const
Returns the predecessor in the list of all hypernodes.
GraphElement * m_element
The associated hyperedge or hypernode.
Class for the representation of hyperedges.
The namespace for all OGDF objects.
int index() const
Returns the index of this adjacency element.
hyperedge succ() const
Returns the successor in the list of all hyperedges.
int maxHyperedgeIndex() const
Returns the largest used hyperedge index.
Lists of graph objects (like nodes, edges, etc.).
int cardinality() const
Returns the number of incident hypernodes.
Type
The type of hypernodes.
internal::GraphList< AdjHypergraphElement > m_adjHypernodes
The adjacency list of the hyperedge.
int m_index
The (unique) index of the adjacency entry.
adjHypergraphEntry firstAdj() const
Returns the first entry in the adjaceny list.
Dynamic arrays indexed with nodes.
Declaration of doubly linked lists and iterators.
Dynamic arrays indexed with hypernodes.
Hypergraph * hypergraph() const
Returns the hypergraph containing the hyperedge.