LLVM API Documentation
#include <Graph.h>
Classes | |
class | EdgeItr |
class | NodeItr |
Public Types | |
typedef unsigned | NodeId |
typedef unsigned | EdgeId |
typedef AdjEdgeList::iterator | AdjEdgeItr |
Public Member Functions | |
Graph () | |
Construct an empty PBQP graph. More... | |
NodeId | addNode (const Vector &costs) |
Add a node with the given costs. More... | |
EdgeId | addEdge (NodeId n1Id, NodeId n2Id, const Matrix &costs) |
Add an edge between the given nodes with the given costs. More... | |
unsigned | getNumNodes () const |
Get the number of nodes in the graph. More... | |
unsigned | getNumEdges () const |
Get the number of edges in the graph. More... | |
Vector & | getNodeCosts (NodeId nId) |
Get a node's cost vector. More... | |
const Vector & | getNodeCosts (NodeId nId) const |
Get a node's cost vector (const version). More... | |
void | setNodeData (NodeId nId, void *data) |
Set a node's data pointer. More... | |
void * | getNodeData (NodeId nId) |
Get the node's data pointer. More... | |
Matrix & | getEdgeCosts (EdgeId eId) |
Get an edge's cost matrix. More... | |
const Matrix & | getEdgeCosts (EdgeId eId) const |
Get an edge's cost matrix (const version). More... | |
void | setEdgeData (EdgeId eId, void *data) |
Set an edge's data pointer. More... | |
void * | getEdgeData (EdgeId eId) |
Get an edge's data pointer. More... | |
unsigned | getNodeDegree (NodeId nId) const |
Get a node's degree. More... | |
NodeItr | nodesBegin () const |
Begin iterator for node set. More... | |
NodeItr | nodesEnd () const |
End iterator for node set. More... | |
EdgeItr | edgesBegin () const |
Begin iterator for edge set. More... | |
EdgeItr | edgesEnd () const |
End iterator for edge set. More... | |
AdjEdgeItr | adjEdgesBegin (NodeId nId) |
Get begin iterator for adjacent edge set. More... | |
AdjEdgeItr | adjEdgesEnd (NodeId nId) |
Get end iterator for adjacent edge set. More... | |
NodeId | getEdgeNode1 (EdgeId eId) |
Get the first node connected to this edge. More... | |
NodeId | getEdgeNode2 (EdgeId eId) |
Get the second node connected to this edge. More... | |
NodeId | getEdgeOtherNode (EdgeId eId, NodeId nId) |
Get the "other" node connected to this edge. More... | |
EdgeId | invalidEdgeId () const |
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 | removeEdge (EdgeId eId) |
Remove an edge from the graph. More... | |
void | clear () |
Remove all nodes and edges from the graph. More... | |
template<typename OStream > | |
void | dump (OStream &os) |
Dump a graph to an output stream. More... | |
template<typename OStream > | |
void | printDot (OStream &os) |
Print a representation of this graph in DOT format. More... | |
typedef AdjEdgeList::iterator PBQP::Graph::AdjEdgeItr |
typedef unsigned PBQP::Graph::EdgeId |
typedef unsigned PBQP::Graph::NodeId |
|
inline |
Add an edge between the given nodes with the given costs.
n1Id | First node. |
n2Id | Second node. |
Definition at line 221 of file Graph.h.
References PBQP::Matrix::getCols(), PBQP::Vector::getLength(), getNodeCosts(), and PBQP::Matrix::getRows().
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::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 213 of file Graph.h.
Referenced by llvm::PBQPBuilder::build().
|
inline |
Get begin iterator for adjacent edge set.
nId | Node id. |
Definition at line 306 of file Graph.h.
Referenced by findEdge(), and PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::setSolution().
|
inline |
Get end iterator for adjacent edge set.
nId | Node id. |
Definition at line 313 of file Graph.h.
Referenced by findEdge(), and PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::setSolution().
|
inline |
|
inline |
Dump a graph to an output stream.
Definition at line 395 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().
|
inline |
Begin iterator for edge set.
Definition at line 298 of file Graph.h.
Referenced by dump(), and printDot().
|
inline |
End iterator for edge set.
Definition at line 301 of file Graph.h.
Referenced by dump(), and printDot().
Get the edge connecting two nodes.
n1Id | First node id. |
n2Id | Second node id. |
Definition at line 352 of file Graph.h.
References adjEdgesBegin(), adjEdgesEnd(), getEdgeNode1(), getEdgeNode2(), and invalidEdgeId().
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), and llvm::PBQPBuilderWithCoalescing::build().
Get an edge's cost matrix.
eId | Edge id. |
Definition at line 263 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR1(), PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), llvm::PBQPBuilder::build(), llvm::PBQPBuilderWithCoalescing::build(), dump(), and printDot().
|
inline |
Get the first node connected to this edge.
eId | Edge id. |
Definition at line 320 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR1(), PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), llvm::PBQPBuilderWithCoalescing::build(), dump(), findEdge(), PBQP::Heuristics::Briggs::handleAddEdge(), PBQP::Heuristics::Briggs::preUpdateEdgeCosts(), printDot(), and PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::removeSolverEdge().
Get the second node connected to this edge.
eId | Edge id. |
Definition at line 327 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR1(), dump(), findEdge(), PBQP::Heuristics::Briggs::handleAddEdge(), PBQP::Heuristics::Briggs::preUpdateEdgeCosts(), printDot(), and PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::removeSolverEdge().
Get the "other" node connected to this edge.
eId | Edge id. |
nId | Node id for the "given" node. |
Definition at line 335 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), and PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::setSolution().
Get a node's cost vector.
nId | Node id. |
Definition at line 239 of file Graph.h.
Referenced by addEdge(), PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR1(), PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), llvm::PBQPBuilder::build(), llvm::PBQPBuilderWithCoalescing::build(), dump(), and printDot().
|
inline |
Get a node's degree.
nId | Node id. |
Definition at line 287 of file Graph.h.
Referenced by PBQP::HeuristicBase< Briggs >::shouldOptimallyReduce().
|
inline |
|
inline |
Get the number of nodes in the graph.
Definition at line 230 of file Graph.h.
Referenced by dump(), and printDot().
|
inline |
Definition at line 343 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), llvm::PBQPBuilderWithCoalescing::build(), and findEdge().
|
inline |
Begin iterator for node set.
Definition at line 292 of file Graph.h.
Referenced by dump(), printDot(), and PBQP::HeuristicBase< Briggs >::setup().
|
inline |
End iterator for node set.
Definition at line 295 of file Graph.h.
Referenced by dump(), printDot(), and PBQP::HeuristicBase< Briggs >::setup().
|
inline |
Print a representation of this graph in DOT format.
os | Output stream to print on. |
Definition at line 433 of file Graph.h.
References edgesBegin(), edgesEnd(), getEdgeCosts(), getEdgeNode1(), getEdgeNode2(), getNodeCosts(), getNumNodes(), PBQP::Matrix::getRowAsVector(), PBQP::Matrix::getRows(), nodesBegin(), and nodesEnd().
|
inline |
Remove an edge from the graph.
eId | Edge id. |
Definition at line 376 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), and removeNode().
|
inline |
Remove a node from the graph.
nId | Node id. |
Definition at line 365 of file Graph.h.
References llvm::sys::path::end(), and removeEdge().
|
inline |
Set an edge's data pointer.
eId | Edge id. |
data | Pointer to edge data. |
Typically used by a PBQP solver to attach data to aid in solution.
Definition at line 277 of file Graph.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2().
|
inline |