LLVM 22.0.0git
|
A Graph object represents a Directed Graph and is used in XRay to compute and store function call graphs and associated statistical information. More...
#include "llvm/XRay/Graph.h"
Classes | |
class | EdgeView |
A class for ranging over all the edges in the graph. More... | |
class | InOutEdgeView |
A class for ranging over the incoming edges incident to a vertex. More... | |
class | VertexView |
A class for ranging over the vertices in the graph. More... |
Public Types | |
typedef VI | VertexIdentifier |
These objects are used to name edges and vertices in the graph. | |
typedef std::pair< VI, VI > | EdgeIdentifier |
using | VertexValueType |
This type is the value_type of all iterators which range over vertices, Determined by the Vertices DenseMap. | |
using | EdgeValueType = detail::DenseMapPair<EdgeIdentifier, EdgeAttribute> |
This type is the value_type of all iterators which range over edges, Determined by the Edges DenseMap. | |
using | size_type = std::size_t |
using | ConstInEdgeIterator = NeighborEdgeIteratorT<true, false> |
A const iterator type for iterating through the set of edges entering a vertex. | |
using | InEdgeIterator = NeighborEdgeIteratorT<false, false> |
An iterator type for iterating through the set of edges leaving a vertex. | |
using | ConstOutEdgeIterator = NeighborEdgeIteratorT<true, true> |
A const iterator type for iterating through the set of edges entering a vertex. | |
using | OutEdgeIterator = NeighborEdgeIteratorT<false, true> |
An iterator type for iterating through the set of edges leaving a vertex. | |
using | ConstVertexIterator = typename VertexMapT::const_iterator |
A const iterator type for iterating through the whole vertex set of the graph. | |
using | VertexIterator = typename VertexMapT::iterator |
An iterator type for iterating through the whole vertex set of the graph. | |
using | ConstEdgeIterator = typename EdgeMapT::const_iterator |
A const iterator for iterating through the entire edge set of the graph. | |
using | EdgeIterator = typename EdgeMapT::iterator |
An iterator for iterating through the entire edge set of the graph. |
Public Member Functions | |
void | clear () |
Empty the Graph. | |
VertexView< false > | vertices () |
Returns a view object allowing iteration over the vertices of the graph. | |
VertexView< true > | vertices () const |
EdgeView< false > | edges () |
Returns a view object allowing iteration over the edges of the graph. | |
EdgeView< true > | edges () const |
InOutEdgeView< false, true > | outEdges (const VertexIdentifier I) |
Returns a view object allowing iteration over the edges which start at a vertex I. | |
InOutEdgeView< true, true > | outEdges (const VertexIdentifier I) const |
InOutEdgeView< false, false > | inEdges (const VertexIdentifier I) |
Returns a view object allowing iteration over the edges which point to a vertex I. | |
InOutEdgeView< true, false > | inEdges (const VertexIdentifier I) const |
VertexAttribute & | operator[] (const VertexIdentifier &I) |
Looks up the vertex with identifier I, if it does not exist it default constructs it. | |
EdgeAttribute & | operator[] (const EdgeIdentifier &I) |
Looks up the edge with identifier I, if it does not exist it default constructs it, if it's endpoints do not exist it also default constructs them. | |
Expected< VertexAttribute & > | at (const VertexIdentifier &I) |
Looks up a vertex with Identifier I, or an error if it does not exist. | |
Expected< const VertexAttribute & > | at (const VertexIdentifier &I) const |
Expected< EdgeAttribute & > | at (const EdgeIdentifier &I) |
Looks up an edge with Identifier I, or an error if it does not exist. | |
Expected< const EdgeAttribute & > | at (const EdgeIdentifier &I) const |
size_type | count (const VertexIdentifier &I) const |
Looks for a vertex with identifier I, returns 1 if one exists, and 0 otherwise. | |
size_type | count (const EdgeIdentifier &I) const |
Looks for an edge with Identifier I, returns 1 if one exists and 0 otherwise. | |
std::pair< VertexIterator, bool > | insert (const std::pair< VertexIdentifier, VertexAttribute > &Val) |
Inserts a vertex into the graph with Identifier Val.first, and Attribute Val.second. | |
std::pair< VertexIterator, bool > | insert (std::pair< VertexIdentifier, VertexAttribute > &&Val) |
std::pair< EdgeIterator, bool > | insert (const std::pair< EdgeIdentifier, EdgeAttribute > &Val) |
Inserts an edge into the graph with Identifier Val.first, and Attribute Val.second. | |
std::pair< EdgeIterator, bool > | insert (std::pair< EdgeIdentifier, EdgeAttribute > &&Val) |
Inserts an edge into the graph with Identifier Val.first, and Attribute Val.second. |
A Graph object represents a Directed Graph and is used in XRay to compute and store function call graphs and associated statistical information.
The graph takes in four template parameters, these are:
Graph is CopyConstructible, CopyAssignable, MoveConstructible and MoveAssignable but is not EqualityComparible or LessThanComparible.
Usage Example Graph with weighted edges and vertices: Graph<int, int, int> G;
G[1] = 0; G[2] = 2; G[{1,2}] = 1; G[{2,1}] = -1; for(const auto &v : G.vertices()){ // Do something with the vertices in the graph; } for(const auto &e : G.edges()){ // Do something with the edges in the graph; }
Usage Example with StrRef keys. Graph<int, double, StrRef> StrG; char va[] = "Vertex A"; char vaa[] = "Vertex A"; char vb[] = "Vertex B"; // Vertices are referenced by String Refs. G[va] = 0; G[vb] = 1; G[{va, vb}] = 1.0; cout() << G[vaa] << " " << G[{vaa, vb}]; //prints "0 1.0".
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::ConstEdgeIterator = typename EdgeMapT::const_iterator |
A const iterator for iterating through the entire edge set of the graph.
Has a const EdgeValueType as its value_type
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::ConstInEdgeIterator = NeighborEdgeIteratorT<true, false> |
A const iterator type for iterating through the set of edges entering a vertex.
Has a const EdgeValueType as its value_type
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::ConstOutEdgeIterator = NeighborEdgeIteratorT<true, true> |
A const iterator type for iterating through the set of edges entering a vertex.
Has a const EdgeValueType as its value_type
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::ConstVertexIterator = typename VertexMapT::const_iterator |
A const iterator type for iterating through the whole vertex set of the graph.
Has a const VertexValueType as its value_type
typedef std::pair<VI, VI> llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::EdgeIdentifier |
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::EdgeIterator = typename EdgeMapT::iterator |
An iterator for iterating through the entire edge set of the graph.
Has an EdgeValueType as its value_type
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::EdgeValueType = detail::DenseMapPair<EdgeIdentifier, EdgeAttribute> |
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::InEdgeIterator = NeighborEdgeIteratorT<false, false> |
An iterator type for iterating through the set of edges leaving a vertex.
Has an EdgeValueType as its value_type
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::OutEdgeIterator = NeighborEdgeIteratorT<false, true> |
An iterator type for iterating through the set of edges leaving a vertex.
Has an EdgeValueType as its value_type
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::size_type = std::size_t |
typedef VI llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::VertexIdentifier |
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::VertexIterator = typename VertexMapT::iterator |
An iterator type for iterating through the whole vertex set of the graph.
Has a VertexValueType as its value_type
using llvm::xray::Graph< VertexAttribute, EdgeAttribute, VI >::VertexValueType |
This type is the value_type of all iterators which range over vertices, Determined by the Vertices DenseMap.
|
inline |
Looks up an edge with Identifier I, or an error if it does not exist.
Definition at line 414 of file Graph.h.
References I, and llvm::make_error().
|
inline |
Definition at line 423 of file Graph.h.
References I, and llvm::make_error().
|
inline |
Looks up a vertex with Identifier I, or an error if it does not exist.
Definition at line 395 of file Graph.h.
References I, and llvm::make_error().
|
inline |
Definition at line 404 of file Graph.h.
References I, and llvm::make_error().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |