38namespace steiner_tree {
40#define OGDF_FULLCOMPONENTSTORE_REMOVE_IN_GRAPH_REPRESENTATION_ALSO
43template<
typename T,
typename ExtraDataType =
void>
53 template<
class Y,
class Enable =
void>
94 edge e = adj->theEdge();
100 T weight(
comp.weight(e));
124 T weight =
comp.weight(e);
166 if (v->degree() > 2) {
210#ifdef OGDF_FULLCOMPONENTSTORE_REMOVE_IN_GRAPH_REPRESENTATION_ALSO
212 if (
comp.terminals.size() == 2) {
218 while (!
stack.empty()) {
222 stack.push(adj->twinNode());
278 template<
typename Fun>
289 while (!
stack.empty()) {
301 template<
typename Fun>
308 template<
typename Fun>
319 template<
typename Fun>
330 v = pred[u][v]->opposite(v);
349template<
typename T,
typename ExtraDataType>
432 for (
int id = 0;
id < this->
size(); ++id) {
436 this->
extra(
id).bridges.pushBack(e);
Extends the GraphCopy concept to weighted graphs.
Declaration and implementation of NodeArray class.
Class for adjacency list elements.
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
edge theEdge() const
Returns the edge associated with this adjacency entry.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
node theNode() const
Returns the node whose adjacency list contains this element.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
The parameterized class Array implements dynamic arrays of type E.
void grow(INDEX add, const E &x)
Enlarges the array by add elements and sets new elements to x.
void quicksort()
Sorts array using Quicksort.
INDEX size() const
Returns the size (number of elements) of the array.
Dynamic arrays indexed with edges.
Class for the representation of edges.
node target() const
Returns the target node of the edge.
node source() const
Returns the source node of the edge.
Doubly linked lists (maintaining the length of the list).
Encapsulates a pointer to a list element.
ListIteratorBase< E, isConst, isReverse > succ() const
Returns successor iterator.
Dynamic arrays indexed with nodes.
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
int index() const
Returns the (unique) node index.
A data structure to store full components.
void remove(int id)
Removes a component by its id.
void foreachNode(int id, const NodeArray< NodeArray< edge > > &pred, Fun f) const
const NodeArray< bool > & m_isTerminal
Incidence vector for terminal nodes.
EdgeWeightedGraph< T > m_graph
Our graph representation for the full component store.
NodeArray< node > m_nodeCopy
Mapping of original terminals to m_graph nodes.
bool isTerminal(node v) const
void copyEdgesWithSimplifiedPaths(Metadata< ExtraDataType > &data, const EdgeWeightedGraphCopy< T > &comp, const ArrayBuffer< node > &nonterminals)
Copy edges from comp into our representation, traversing variant to ignore degree-2 nodes.
void traverseOverDegree2Nonterminals(node &uO, T &weight, EdgeArray< bool > &marked, adjEntry adj, const EdgeWeightedGraphCopy< T > &comp) const
Traverse over degree-2 nonterminals.
bool isEmpty() const
Checks if the store does not contain any full components.
const EdgeWeightedGraph< T > & m_originalGraph
The original Steiner instance.
const List< node > & m_terminals
The terminal list of the original Steiner instance.
ArrayBuffer< Metadata< ExtraDataType > > m_components
List of full components (based on metadata)
bool isTerminal(int id, node t) const
checks if a given node t is a terminal in the full component with given id
void copyEdges(Metadata< ExtraDataType > &data, const EdgeWeightedGraphCopy< T > &comp)
Copy edges from comp into our representation.
void foreachEdge(int id, const NodeArray< NodeArray< edge > > &pred, Fun f) const
NodeArray< node > m_nodeOrig
Mapping of m_graph nodes to original nodes.
adjEntry start(int i) const
FullComponentStore(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal)
T cost(int i) const
Returns the sum of edge costs of this full component.
const EdgeWeightedGraph< T > & graph() const
node original(node v) const
void foreachNode(int id, Fun f) const
void foreachAdjEntry(int i, Fun f) const
const Array< node > & terminals(int id) const
Returns the list of terminals in the full component with given id.
void insert(const EdgeWeightedGraphCopy< T > &comp)
Inserts a component. Note that comp is copied and degree-2 nodes are removed.
int size() const
Returns the number of full components in the store.
A data structure to store full components with additional "loss" functionality.
void computeAllLosses()
Compute the loss, both edge set and value, of all full components.
node lossTerminal(node v) const
Returns the terminal (in the original graph) that belongs to a given node v (in the store) according ...
const List< edge > & lossBridges(int id) const
Returns a list of non-loss edges (that are bridges between the Loss components) of full component wit...
NodeArray< node > m_lossTerminal
Indicates which Steiner node is connected to which terminal through the loss edges,...
node findLossTerminal(const node u, const NodeArray< edge > &pred)
Starting from a Steiner node find the nearest terminal along a shortest path.
T loss(int id) const
Returns the loss value of full component with given id.
T computeMinST(const Graph &G, const EdgeArray< T > &weight, EdgeArray< bool > &isInTree)
Computes a minimum spanning tree using Prim's algorithm.
bool isTree(const Graph &G)
Returns true iff G is a tree, i.e. contains no undirected cycle and is connected.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
Compare elements based on a single comparable attribute.