|
| Graph ()=default |
| Construct an empty PBQP graph. More...
|
|
| Graph (GraphMetadata Metadata) |
| Construct an empty PBQP graph with the given graph metadata. More...
|
|
GraphMetadata & | getMetadata () |
| Get a reference to the graph metadata. More...
|
|
const GraphMetadata & | getMetadata () const |
| Get a const-reference to the graph metadata. More...
|
|
void | setSolver (SolverT &S) |
| Lock this graph to the given solver instance in preparation for running the solver. More...
|
|
void | unsetSolver () |
| Release from solver instance. More...
|
|
template<typename OtherVectorT > |
NodeId | addNode (OtherVectorT Costs) |
| Add a node with the given costs. More...
|
|
template<typename OtherVectorPtrT > |
NodeId | addNodeBypassingCostAllocator (OtherVectorPtrT Costs) |
| Add a node bypassing the cost allocator. More...
|
|
template<typename OtherVectorT > |
EdgeId | addEdge (NodeId N1Id, NodeId N2Id, OtherVectorT Costs) |
| Add an edge between the given nodes with the given costs. More...
|
|
template<typename OtherMatrixPtrT > |
NodeId | addEdgeBypassingCostAllocator (NodeId N1Id, NodeId N2Id, OtherMatrixPtrT Costs) |
| Add an edge bypassing the cost allocator. More...
|
|
bool | empty () const |
| Returns true if the graph is empty. More...
|
|
NodeIdSet | nodeIds () const |
|
EdgeIdSet | edgeIds () const |
|
AdjEdgeIdSet | adjEdgeIds (NodeId NId) |
|
unsigned | getNumNodes () const |
| Get the number of nodes in the graph. More...
|
|
unsigned | getNumEdges () const |
| Get the number of edges in the graph. More...
|
|
template<typename OtherVectorT > |
void | setNodeCosts (NodeId NId, OtherVectorT Costs) |
| Set a node's cost vector. More...
|
|
const VectorPtr & | getNodeCostsPtr (NodeId NId) const |
| Get a VectorPtr to a node's cost vector. More...
|
|
const Vector & | getNodeCosts (NodeId NId) const |
| Get a node's cost vector. More...
|
|
NodeMetadata & | getNodeMetadata (NodeId NId) |
|
const NodeMetadata & | getNodeMetadata (NodeId NId) const |
|
NodeEntry::AdjEdgeList::size_type | getNodeDegree (NodeId NId) const |
|
template<typename OtherMatrixT > |
void | updateEdgeCosts (EdgeId EId, OtherMatrixT Costs) |
| Update an edge's cost matrix. More...
|
|
const MatrixPtr & | getEdgeCostsPtr (EdgeId EId) const |
| Get a MatrixPtr to a node's cost matrix. More...
|
|
const Matrix & | getEdgeCosts (EdgeId EId) const |
| Get an edge's cost matrix. More...
|
|
EdgeMetadata & | getEdgeMetadata (EdgeId EId) |
|
const EdgeMetadata & | getEdgeMetadata (EdgeId EId) const |
|
NodeId | getEdgeNode1Id (EdgeId EId) const |
| Get the first node connected to this edge. More...
|
|
NodeId | getEdgeNode2Id (EdgeId EId) const |
| Get the second node connected to this edge. More...
|
|
NodeId | getEdgeOtherNodeId (EdgeId EId, NodeId NId) |
| Get the "other" node connected to this edge. More...
|
|
EdgeId | findEdge (NodeId N1Id, NodeId N2Id) |
| Get the edge connecting two nodes. More...
|
|
void | removeNode (NodeId NId) |
| Remove a node from the graph. More...
|
|
void | disconnectEdge (EdgeId EId, NodeId NId) |
| Disconnect an edge from the given node. More...
|
|
void | disconnectAllNeighborsFromNode (NodeId NId) |
| Convenience method to disconnect all neighbours from the given node. More...
|
|
void | reconnectEdge (EdgeId EId, NodeId NId) |
| Re-attach an edge to its nodes. More...
|
|
void | removeEdge (EdgeId EId) |
| Remove an edge from the graph. More...
|
|
void | clear () |
| Remove all nodes and edges from the graph. More...
|
|
template<typename SolverT>
class llvm::PBQP::Graph< SolverT >
PBQP Graph class.
Instances of this class describe PBQP problems.
Definition at line 47 of file Graph.h.
template<typename SolverT>
template<typename OtherMatrixPtrT >
Add an edge bypassing the cost allocator.
- Parameters
-
N1Id | First node. |
N2Id | Second node. |
Costs | Cost matrix for new edge. |
- Returns
- Edge iterator for the added edge.
This method allows for fast addition of an edge whose costs don't need to be passed through the cost allocator. The most common use case for this is when duplicating costs from an existing edge (when using a pooling allocator). These have already been uniqued, so we can avoid re-constructing and re-uniquing them by attaching them directly to the new edge.
Definition at line 435 of file Graph.h.
template<typename SolverT>
template<typename OtherVectorPtrT >
Add a node bypassing the cost allocator.
- Parameters
-
Costs | Cost vector ptr for the new node (must be convertible to VectorPtr). |
- Returns
- Node iterator for the added node.
This method allows for fast addition of a node whose costs don't need to be passed through the cost allocator. The most common use case for this is when duplicating costs from an existing node (when using a pooling allocator). These have already been uniqued, so we can avoid re-constructing and re-uniquing them by attaching them directly to the new node.
Definition at line 397 of file Graph.h.
template<typename SolverT>
Disconnect an edge from the given node.
Removes the given edge from the adjacency list of the given node. This operation leaves the edge in an 'asymmetric' state: It will no longer appear in an iteration over the given node's (NId's) edges, but will appear in an iteration over the 'other', unnamed node's edges.
This does not correspond to any normal graph operation, but exists to support efficient PBQP graph-reduction based solvers. It is used to 'effectively' remove the unnamed node from the graph while the solver is performing the reduction. The solver will later call reconnectNode to restore the edge in the named node's adjacency list.
Since the degree of a node is the number of connected edges, disconnecting an edge from a node 'u' will cause the degree of 'u' to drop by 1.
A disconnected edge WILL still appear in an iteration over the graph edges.
A disconnected edge should not be removed from the graph, it should be reconnected first.
A disconnected edge can be reconnected by calling the reconnectEdge method.
Definition at line 626 of file Graph.h.
template<typename SolverT>
Get a MatrixPtr to a node's cost matrix.
Rarely useful - use getEdgeCosts where possible.
- Parameters
-
- Returns
- MatrixPtr to edge cost matrix.
This method is primarily useful for duplicating costs quickly by bypassing the cost allocator. See addNodeBypassingCostAllocator. Prefer getEdgeCosts when dealing with edge cost values.
Definition at line 524 of file Graph.h.
template<typename SolverT>
Get a VectorPtr to a node's cost vector.
Rarely useful - use getNodeCosts where possible.
- Parameters
-
- Returns
- VectorPtr to node cost vector.
This method is primarily useful for duplicating costs quickly by bypassing the cost allocator. See addNodeBypassingCostAllocator. Prefer getNodeCosts when dealing with node cost values.
Definition at line 482 of file Graph.h.
template<typename SolverT>
Lock this graph to the given solver instance in preparation for running the solver.
This method will call solver.handleAddNode for each node in the graph, and handleAddEdge for each edge, to give the solver an opportunity to set up any requried metadata.
Definition at line 357 of file Graph.h.