LLVM API Documentation
#include <Graph.h>
Classes | |
| class | EdgeEntry |
| class | NodeEntry |
Public Types | |
| typedef NodeList::iterator | NodeItr |
| typedef NodeList::const_iterator | ConstNodeItr |
| typedef EdgeList::iterator | EdgeItr |
| typedef EdgeList::const_iterator | ConstEdgeItr |
| typedef AdjEdgeList::iterator | AdjEdgeItr |
Public Member Functions | |
| Graph () | |
| Construct an empty PBQP graph. | |
| Graph (const Graph &other) | |
| Copy construct this graph from "other". Note: Does not copy node and edge data, only graph structure and costs. | |
| Graph & | operator= (const Graph &other) |
| Make this graph a copy of "other". Note: Does not copy node and edge data, only graph structure and costs. | |
| NodeItr | addNode (const Vector &costs) |
| Add a node with the given costs. | |
| EdgeItr | addEdge (Graph::NodeItr n1Itr, Graph::NodeItr n2Itr, const Matrix &costs) |
| Add an edge between the given nodes with the given costs. | |
| unsigned | getNumNodes () const |
| Get the number of nodes in the graph. | |
| unsigned | getNumEdges () const |
| Get the number of edges in the graph. | |
| Vector & | getNodeCosts (NodeItr nItr) |
| Get a node's cost vector. | |
| const Vector & | getNodeCosts (ConstNodeItr nItr) const |
| Get a node's cost vector (const version). | |
| void | setNodeData (NodeItr nItr, void *data) |
| Set a node's data pointer. | |
| void * | getNodeData (NodeItr nItr) |
| Get the node's data pointer. | |
| Matrix & | getEdgeCosts (EdgeItr eItr) |
| Get an edge's cost matrix. | |
| const Matrix & | getEdgeCosts (ConstEdgeItr eItr) const |
| Get an edge's cost matrix (const version). | |
| void | setEdgeData (EdgeItr eItr, void *data) |
| Set an edge's data pointer. | |
| void * | getEdgeData (EdgeItr eItr) |
| Get an edge's data pointer. | |
| unsigned | getNodeDegree (NodeItr nItr) const |
| Get a node's degree. | |
| NodeItr | nodesBegin () |
| Begin iterator for node set. | |
| ConstNodeItr | nodesBegin () const |
| Begin const iterator for node set. | |
| NodeItr | nodesEnd () |
| End iterator for node set. | |
| ConstNodeItr | nodesEnd () const |
| End const iterator for node set. | |
| EdgeItr | edgesBegin () |
| Begin iterator for edge set. | |
| EdgeItr | edgesEnd () |
| End iterator for edge set. | |
| AdjEdgeItr | adjEdgesBegin (NodeItr nItr) |
| Get begin iterator for adjacent edge set. | |
| AdjEdgeItr | adjEdgesEnd (NodeItr nItr) |
| Get end iterator for adjacent edge set. | |
| NodeItr | getEdgeNode1 (EdgeItr eItr) |
| Get the first node connected to this edge. | |
| NodeItr | getEdgeNode2 (EdgeItr eItr) |
| Get the second node connected to this edge. | |
| NodeItr | getEdgeOtherNode (EdgeItr eItr, NodeItr nItr) |
| Get the "other" node connected to this edge. | |
| EdgeItr | findEdge (NodeItr n1Itr, NodeItr n2Itr) |
| Get the edge connecting two nodes. | |
| void | removeNode (NodeItr nItr) |
| Remove a node from the graph. | |
| void | removeEdge (EdgeItr eItr) |
| Remove an edge from the graph. | |
| void | clear () |
| Remove all nodes and edges from the graph. | |
| template<typename OStream > | |
| void | dump (OStream &os) |
| Dump a graph to an output stream. | |
| template<typename OStream > | |
| void | printDot (OStream &os) |
| Print a representation of this graph in DOT format. | |
| typedef AdjEdgeList::iterator PBQP::Graph::AdjEdgeItr |
| PBQP::Graph::Graph | ( | ) | [inline] |
| PBQP::Graph::Graph | ( | const Graph & | other | ) | [inline] |
| EdgeItr PBQP::Graph::addEdge | ( | Graph::NodeItr | n1Itr, |
| Graph::NodeItr | n2Itr, | ||
| const Matrix & | costs | ||
| ) | [inline] |
Add an edge between the given nodes with the given costs.
| n1Itr | First node. |
| n2Itr | Second node. |
Definition at line 181 of file Graph.h.
References PBQP::Matrix::getCols(), PBQP::Vector::getLength(), getNodeCosts(), and PBQP::Matrix::getRows().
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR2(), llvm::PBQPBuilder::build(), and llvm::PBQPBuilderWithCoalescing::build().
Add a node with the given costs.
| costs | Cost vector for the new node. |
Definition at line 173 of file Graph.h.
Referenced by llvm::PBQPBuilder::build().
| AdjEdgeItr PBQP::Graph::adjEdgesBegin | ( | NodeItr | nItr | ) | [inline] |
Get begin iterator for adjacent edge set.
| nItr | Node iterator. |
Definition at line 273 of file Graph.h.
Referenced by findEdge(), and PBQP::HeuristicSolverImpl< Briggs >::setSolution().
| AdjEdgeItr PBQP::Graph::adjEdgesEnd | ( | NodeItr | nItr | ) | [inline] |
Get end iterator for adjacent edge set.
| nItr | Node iterator. |
Definition at line 280 of file Graph.h.
Referenced by findEdge(), and PBQP::HeuristicSolverImpl< Briggs >::setSolution().
| void PBQP::Graph::clear | ( | ) | [inline] |
Remove all nodes and edges from the graph.
Definition at line 352 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::clear().
Referenced by operator=().
| void PBQP::Graph::dump | ( | OStream & | os | ) | [inline] |
Dump a graph to an output stream.
Definition at line 360 of file Graph.h.
References edgesBegin(), edgesEnd(), PBQP::Matrix::getCols(), getEdgeCosts(), getEdgeNode1(), getEdgeNode2(), PBQP::Vector::getLength(), getNodeCosts(), getNumEdges(), getNumNodes(), PBQP::Matrix::getRows(), nodesBegin(), and nodesEnd().
| EdgeItr PBQP::Graph::edgesBegin | ( | ) | [inline] |
Begin iterator for edge set.
Definition at line 265 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by dump(), and printDot().
| EdgeItr PBQP::Graph::edgesEnd | ( | ) | [inline] |
End iterator for edge set.
Definition at line 268 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR2(), llvm::PBQPBuilderWithCoalescing::build(), dump(), and printDot().
Get the edge connecting two nodes.
| n1Itr | First node iterator. |
| n2Itr | Second node iterator. |
Definition at line 315 of file Graph.h.
References adjEdgesBegin(), adjEdgesEnd(), llvm::iplist< NodeTy, Traits >::end(), getEdgeNode1(), and getEdgeNode2().
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR2(), and llvm::PBQPBuilderWithCoalescing::build().
Get an edge's cost matrix.
| eItr | Edge iterator. |
Definition at line 224 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR1(), PBQP::HeuristicSolverImpl< Briggs >::applyR2(), llvm::PBQPBuilder::build(), llvm::PBQPBuilderWithCoalescing::build(), dump(), and printDot().
| const Matrix& PBQP::Graph::getEdgeCosts | ( | ConstEdgeItr | eItr | ) | const [inline] |
| void* PBQP::Graph::getEdgeData | ( | EdgeItr | eItr | ) | [inline] |
Get the first node connected to this edge.
| eItr | Edge iterator. |
Definition at line 287 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR1(), PBQP::HeuristicSolverImpl< Briggs >::applyR2(), llvm::PBQPBuilderWithCoalescing::build(), dump(), findEdge(), PBQP::Heuristics::Briggs::handleAddEdge(), PBQP::Heuristics::Briggs::preUpdateEdgeCosts(), printDot(), and PBQP::HeuristicSolverImpl< Briggs >::removeSolverEdge().
Get the second node connected to this edge.
| eItr | Edge iterator. |
Definition at line 294 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR1(), dump(), findEdge(), PBQP::Heuristics::Briggs::handleAddEdge(), PBQP::Heuristics::Briggs::preUpdateEdgeCosts(), printDot(), and PBQP::HeuristicSolverImpl< Briggs >::removeSolverEdge().
Get the "other" node connected to this edge.
| eItr | Edge iterator. |
| nItr | Node iterator for the "given" node. |
Definition at line 302 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR2(), and PBQP::HeuristicSolverImpl< Briggs >::setSolution().
Get a node's cost vector.
| nItr | Node iterator. |
Definition at line 200 of file Graph.h.
Referenced by addEdge(), PBQP::HeuristicSolverImpl< Briggs >::applyR1(), PBQP::HeuristicSolverImpl< Briggs >::applyR2(), llvm::PBQPBuilder::build(), llvm::PBQPBuilderWithCoalescing::build(), dump(), and printDot().
| const Vector& PBQP::Graph::getNodeCosts | ( | ConstNodeItr | nItr | ) | const [inline] |
| void* PBQP::Graph::getNodeData | ( | NodeItr | nItr | ) | [inline] |
Get a node's degree.
| nItr | Node iterator. |
Definition at line 248 of file Graph.h.
Referenced by PBQP::HeuristicBase< Briggs >::shouldOptimallyReduce().
| unsigned PBQP::Graph::getNumEdges | ( | ) | const [inline] |
| unsigned PBQP::Graph::getNumNodes | ( | ) | const [inline] |
Get the number of nodes in the graph.
Definition at line 191 of file Graph.h.
Referenced by dump(), and printDot().
| NodeItr PBQP::Graph::nodesBegin | ( | ) | [inline] |
Begin iterator for node set.
Definition at line 253 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by dump(), printDot(), and PBQP::HeuristicBase< Briggs >::setup().
| ConstNodeItr PBQP::Graph::nodesBegin | ( | ) | const [inline] |
Begin const iterator for node set.
Definition at line 256 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::begin().
| NodeItr PBQP::Graph::nodesEnd | ( | ) | [inline] |
End iterator for node set.
Definition at line 259 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by dump(), printDot(), and PBQP::HeuristicBase< Briggs >::setup().
| ConstNodeItr PBQP::Graph::nodesEnd | ( | ) | const [inline] |
End const iterator for node set.
Definition at line 262 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::end().
Make this graph a copy of "other". Note: Does not copy node and edge data, only graph structure and costs.
| other | The graph to copy from. |
This will clear the current graph, erasing any nodes and edges added, before copying from other.
Definition at line 164 of file Graph.h.
References clear().
| void PBQP::Graph::printDot | ( | OStream & | os | ) | [inline] |
Print a representation of this graph in DOT format.
| os | Output stream to print on. |
Definition at line 398 of file Graph.h.
References edgesBegin(), edgesEnd(), getEdgeCosts(), getEdgeNode1(), getEdgeNode2(), getNodeCosts(), getNumNodes(), PBQP::Matrix::getRowAsVector(), PBQP::Matrix::getRows(), nodesBegin(), and nodesEnd().
| void PBQP::Graph::removeEdge | ( | EdgeItr | eItr | ) | [inline] |
Remove an edge from the graph.
| eItr | Edge iterator. |
Definition at line 341 of file Graph.h.
References llvm::iplist< NodeTy, Traits >::erase().
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR2(), and removeNode().
| void PBQP::Graph::removeNode | ( | NodeItr | nItr | ) | [inline] |
Remove a node from the graph.
| nItr | Node iterator. |
Definition at line 328 of file Graph.h.
References llvm::sys::path::end(), llvm::iplist< NodeTy, Traits >::erase(), and removeEdge().
| void PBQP::Graph::setEdgeData | ( | EdgeItr | eItr, |
| void * | data | ||
| ) | [inline] |
Set an edge's data pointer.
| eItr | Edge iterator. |
| data | Pointer to edge data. |
Typically used by a PBQP solver to attach data to aid in solution.
Definition at line 238 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< Briggs >::applyR2().
| void PBQP::Graph::setNodeData | ( | NodeItr | nItr, |
| void * | data | ||
| ) | [inline] |