PandA-2024.02
Data Structures | Namespaces | Macros | Typedefs | Functions
graph.hpp File Reference

Class specification of the graph structures. More...

#include "edge_info.hpp"
#include "graph_info.hpp"
#include "node_info.hpp"
#include <fstream>
#include <ostream>
#include "custom_set.hpp"
#include <deque>
#include <list>
#include "exceptions.hpp"
#include "refcount.hpp"
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/topological_sort.hpp>
#include <boost/version.hpp>
#include <utility>
Include dependency graph for graph.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RawGraph
 
struct  EdgeProperty
 The property associated with edge. More...
 
struct  graph_info_t
 Custom graph property: GraphInfo. More...
 
struct  graphs_collection
 bulk graph. More...
 
struct  undirected_graphs_collection
 bulk graph. More...
 
struct  SelectVertex< Graph >
 Predicate functor object used to select the proper set of vertexes. More...
 
struct  SelectEdge< Graph >
 Predicate functor object used to select the proper set of edges. More...
 
struct  graph
 General class used to describe a graph in PandA. More...
 
struct  ugraph
 General class used to describe a graph in PandA. More...
 
struct  ltedge< Graph >
 Functor used to sort edges. More...
 
struct  std::hash< EdgeDescriptor >
 
class  VertexWriter
 Functor used to write the content of a vertex to dotty file. More...
 
class  EdgeWriter
 Functor used to write the content of the edges to a dotty file. More...
 
class  GraphWriter
 Functor used to write the content of the property of a graph to a dotty file. More...
 
class  UVertexWriter
 Functor used to write the content of a vertex to dotty file. More...
 
class  UEdgeWriter
 Functor used to write the content of the edges to a dotty file. More...
 

Namespaces

 std
 Definition of hash function for EdgeDescriptor.
 

Macros

#define GET_RAW_EDGE_INFO(data, edge_info, edge_index)   get_edge_info<edge_info>(edge_index, *(data))
 
#define CGET_RAW_EDGE_INFO(data, edge_info, edge_index)   Cget_edge_info<edge_info>(edge_index, *(data))
 
#define boost_CGetOpGraph_property(graph_arg)   boost::get_property(graph_arg, graph_info_t())
 
#define SET_NODE_INFO_REF(data, NodeInfo, obj, vertex_index)   set_node_info<NodeInfo>(vertex_index, obj, *(data))
 
#define GET_NODE_INFO_REF(data, NodeInfo, vertex_index)   Cget_node_infoRef<NodeInfo>(vertex_index, *(data))
 
#define GET_NODE_INFO(data, NodeInfo, vertex_index)   get_node_info<NodeInfo>(vertex_index, *(data))
 
#define CGET_NODE_INFO(data, NodeInfo, vertex_index)   Cget_node_info<NodeInfo>(vertex_index, *(data))
 
#define GET_EDGE_INFO(data, edge_info, edge_index)   get_edge_info<edge_info>(edge_index, *(data))
 
#define CGET_EDGE_INFO(data, edge_info, edge_index)   Cget_edge_info<edge_info>(edge_index, *(data))
 
#define NULL_VERTEX   boost::graph_traits<graph>::null_vertex()
 null vertex definition More...
 
#define NULL_UVERTEX   boost::graph_traits<ugraph>::null_vertex()
 null vertex definition More...
 
#define NULL_UGCVERTEX   boost::graph_traits<undirected_graphs_collection>::null_vertex()
 

Typedefs

using boost_raw_graph = boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::property< boost::vertex_index_t, std::size_t, NodeInfoRef >, EdgeInfoRef, GraphInfoRef >
 
typedef boost::property< graph_info_t, GraphInfoRefGraphProperty
 
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::property< boost::vertex_index_t, std::size_t, boost::property< boost::vertex_color_t, boost::default_color_type, NodeInfoRef > >, EdgeProperty, GraphPropertyboost_graphs_collection
 
typedef boost::adjacency_list< boost::listS, boost::listS, boost::undirectedS, boost::property< boost::vertex_index_t, std::size_t, boost::property< boost::vertex_color_t, boost::default_color_type, NodeInfoRef > >, EdgeProperty, GraphPropertyundirected_boost_graphs_collection
 
using graphs_collectionRef = refcount< graphs_collection >
 
using undirected_graphs_collectionRef = refcount< undirected_graphs_collection >
 
using graphRef = refcount< graph >
 
using graphConstRef = refcount< const graph >
 
using ugraphRef = refcount< ugraph >
 
using vertex = boost::graph_traits< graph >::vertex_descriptor
 vertex definition. More...
 
using VertexIterator = boost::graph_traits< graph >::vertex_iterator
 vertex_iterator definition. More...
 
using InEdgeIterator = boost::graph_traits< graph >::in_edge_iterator
 in_edge_iterator definition. More...
 
using OutEdgeIterator = boost::graph_traits< graph >::out_edge_iterator
 out_edge_iterator definition. More...
 
using EdgeIterator = boost::graph_traits< graph >::edge_iterator
 edge_iterator definition. More...
 
using EdgeDescriptor = boost::graph_traits< graph >::edge_descriptor
 edge definition. More...
 
using uvertex = boost::graph_traits< ugraph >::vertex_descriptor
 vertex definition. More...
 
using UGCvertex = boost::graph_traits< undirected_graphs_collection >::vertex_descriptor
 vertex definition for undirected_graphs_collection. More...
 
using UVertexIterator = boost::graph_traits< ugraph >::vertex_iterator
 vertex_iterator definition. More...
 
using UInEdgeIterator = boost::graph_traits< ugraph >::in_edge_iterator
 in_edge_iterator definition. More...
 
using UOutEdgeIterator = boost::graph_traits< ugraph >::out_edge_iterator
 out_edge_iterator definition. More...
 
using UEdgeIterator = boost::graph_traits< ugraph >::edge_iterator
 edge_iterator definition. More...
 
using UEdgeDescriptor = boost::graph_traits< ugraph >::edge_descriptor
 edge definition. More...
 

Functions

template<class info_object , class Graph >
info_object * get_raw_edge_info (typename boost::graph_traits< Graph >::edge_descriptor e, Graph &g)
 Function returning the edge information associated with the specified edge. More...
 
template<class info_object , class Graph >
const info_object * Cget_raw_edge_info (typename boost::graph_traits< Graph >::edge_descriptor e, const Graph &g)
 Function returning the edge information associated with the specified edge. More...
 
template<class info_object , class Graph >
NodeInfoRefCget_node_infoRef (typename boost::graph_traits< Graph >::vertex_descriptor v, Graph &g)
 Function returning the reference to the edge information associated with the specified edge. More...
 
template<class info_object , class Graph >
void set_node_info (typename boost::graph_traits< Graph >::vertex_descriptor v, const refcount< info_object > &obj, Graph &g)
 Function returning the node information associated with the specified node. More...
 
template<class info_object , class Graph >
info_object * get_node_info (typename boost::graph_traits< Graph >::vertex_descriptor v, Graph &g)
 Function returning the node information associated with the specified node. More...
 
template<class info_object , class Graph >
const info_object * Cget_node_info (typename boost::graph_traits< Graph >::vertex_descriptor v, const Graph &g)
 Function returning the node information associated with the specified node. More...
 
template<class info_object , class Graph >
info_object * get_edge_info (typename boost::graph_traits< Graph >::edge_descriptor e, Graph &g)
 Function returning the edge information associated with the specified edge. More...
 
template<class info_object , class Graph >
const info_object * Cget_edge_info (typename boost::graph_traits< Graph >::edge_descriptor e, const Graph &g)
 Function returning the edge information associated with the specified edge. More...
 
template<typename H >
H AbslHashValue (const H &h, const EdgeDescriptor &m)
 
boost::graph_traits< graph >::vertex_descriptor VERTEX (const boost::graph_traits< graph >::vertices_size_type i, const graph &g)
 Given a filtered graph and an index returns the vertex exploiting the boost::vertex applied on the original graph. More...
 
boost::graph_traits< ugraph >::vertex_descriptor VERTEX (const boost::graph_traits< ugraph >::vertices_size_type i, const ugraph &g)
 Given a filtered ugraph and an index returns the vertex exploiting the boost::vertex applied on the original graph. More...
 
template<class Graph >
void ADD_UEDGE (typename boost::graph_traits< Graph >::vertex_descriptor A, typename boost::graph_traits< Graph >::vertex_descriptor B, int selector, Graph &g)
 
forward declarations

Graph include

STD include STL include Utility include

 CONSTREF_FORWARD_DECL (EdgeInfo)
 
 CONSTREF_FORWARD_DECL (EdgeWriter)
 
 CONSTREF_FORWARD_DECL (GraphWriter)
 
 CONSTREF_FORWARD_DECL (NodeInfo)
 
 REF_FORWARD_DECL (NodeInfo)
 
 CONSTREF_FORWARD_DECL (Parameter)
 
 CONSTREF_FORWARD_DECL (UEdgeWriter)
 
 CONSTREF_FORWARD_DECL (UVertexWriter)
 
 CONSTREF_FORWARD_DECL (VertexWriter)
 

Detailed Description

Class specification of the graph structures.

Author
Fabrizio Ferrandi fabri.nosp@m.zio..nosp@m.ferra.nosp@m.ndi@.nosp@m.polim.nosp@m.i.it
Marco Lattuada lattu.nosp@m.ada@.nosp@m.elet..nosp@m.poli.nosp@m.mi.it

Definition in file graph.hpp.

Macro Definition Documentation

◆ boost_CGetOpGraph_property

#define boost_CGetOpGraph_property (   graph_arg)    boost::get_property(graph_arg, graph_info_t())

◆ CGET_EDGE_INFO

#define CGET_EDGE_INFO (   data,
  edge_info,
  edge_index 
)    Cget_edge_info<edge_info>(edge_index, *(data))

Definition at line 645 of file graph.hpp.

◆ CGET_NODE_INFO

#define CGET_NODE_INFO (   data,
  NodeInfo,
  vertex_index 
)    Cget_node_info<NodeInfo>(vertex_index, *(data))

Definition at line 603 of file graph.hpp.

◆ CGET_RAW_EDGE_INFO

#define CGET_RAW_EDGE_INFO (   data,
  edge_info,
  edge_index 
)    Cget_edge_info<edge_info>(edge_index, *(data))

Definition at line 199 of file graph.hpp.

◆ GET_EDGE_INFO

#define GET_EDGE_INFO (   data,
  edge_info,
  edge_index 
)    get_edge_info<edge_info>(edge_index, *(data))

Definition at line 643 of file graph.hpp.

◆ GET_NODE_INFO

#define GET_NODE_INFO (   data,
  NodeInfo,
  vertex_index 
)    get_node_info<NodeInfo>(vertex_index, *(data))

◆ GET_NODE_INFO_REF

#define GET_NODE_INFO_REF (   data,
  NodeInfo,
  vertex_index 
)    Cget_node_infoRef<NodeInfo>(vertex_index, *(data))

Definition at line 561 of file graph.hpp.

◆ GET_RAW_EDGE_INFO

#define GET_RAW_EDGE_INFO (   data,
  edge_info,
  edge_index 
)    get_edge_info<edge_info>(edge_index, *(data))

Definition at line 197 of file graph.hpp.

◆ NULL_UGCVERTEX

#define NULL_UGCVERTEX   boost::graph_traits<undirected_graphs_collection>::null_vertex()

Definition at line 1348 of file graph.hpp.

◆ NULL_UVERTEX

#define NULL_UVERTEX   boost::graph_traits<ugraph>::null_vertex()

null vertex definition

Definition at line 1344 of file graph.hpp.

◆ NULL_VERTEX

#define NULL_VERTEX   boost::graph_traits<graph>::null_vertex()

◆ SET_NODE_INFO_REF

#define SET_NODE_INFO_REF (   data,
  NodeInfo,
  obj,
  vertex_index 
)    set_node_info<NodeInfo>(vertex_index, obj, *(data))

Definition at line 559 of file graph.hpp.

Typedef Documentation

◆ boost_graphs_collection

typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::property<boost::vertex_index_t, std::size_t, boost::property<boost::vertex_color_t, boost::default_color_type, NodeInfoRef> >, EdgeProperty, GraphProperty> boost_graphs_collection

Definition at line 271 of file graph.hpp.

◆ boost_raw_graph

using boost_raw_graph = boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS, boost::property<boost::vertex_index_t, std::size_t, NodeInfoRef>, EdgeInfoRef, GraphInfoRef>

Definition at line 89 of file graph.hpp.

◆ EdgeDescriptor

using EdgeDescriptor = boost::graph_traits<graph>::edge_descriptor

edge definition.

Definition at line 1316 of file graph.hpp.

◆ EdgeIterator

using EdgeIterator = boost::graph_traits<graph>::edge_iterator

edge_iterator definition.

Definition at line 1314 of file graph.hpp.

◆ graphConstRef

using graphConstRef = refcount<const graph>

Definition at line 1123 of file graph.hpp.

◆ GraphProperty

typedef boost::property<graph_info_t, GraphInfoRef> GraphProperty

Definition at line 264 of file graph.hpp.

◆ graphRef

Definition at line 1122 of file graph.hpp.

◆ graphs_collectionRef

Definition at line 462 of file graph.hpp.

◆ InEdgeIterator

using InEdgeIterator = boost::graph_traits<graph>::in_edge_iterator

in_edge_iterator definition.

Definition at line 1310 of file graph.hpp.

◆ OutEdgeIterator

using OutEdgeIterator = boost::graph_traits<graph>::out_edge_iterator

out_edge_iterator definition.

Definition at line 1312 of file graph.hpp.

◆ UEdgeDescriptor

using UEdgeDescriptor = boost::graph_traits<ugraph>::edge_descriptor

edge definition.

Definition at line 1360 of file graph.hpp.

◆ UEdgeIterator

using UEdgeIterator = boost::graph_traits<ugraph>::edge_iterator

edge_iterator definition.

Definition at line 1358 of file graph.hpp.

◆ UGCvertex

using UGCvertex = boost::graph_traits<undirected_graphs_collection>::vertex_descriptor

vertex definition for undirected_graphs_collection.

Definition at line 1347 of file graph.hpp.

◆ ugraphRef

Definition at line 1264 of file graph.hpp.

◆ UInEdgeIterator

using UInEdgeIterator = boost::graph_traits<ugraph>::in_edge_iterator

in_edge_iterator definition.

Definition at line 1354 of file graph.hpp.

◆ undirected_boost_graphs_collection

typedef boost::adjacency_list< boost::listS, boost::listS, boost::undirectedS, boost::property<boost::vertex_index_t, std::size_t, boost::property<boost::vertex_color_t, boost::default_color_type, NodeInfoRef> >, EdgeProperty, GraphProperty> undirected_boost_graphs_collection

Definition at line 278 of file graph.hpp.

◆ undirected_graphs_collectionRef

Definition at line 525 of file graph.hpp.

◆ UOutEdgeIterator

using UOutEdgeIterator = boost::graph_traits<ugraph>::out_edge_iterator

out_edge_iterator definition.

Definition at line 1356 of file graph.hpp.

◆ uvertex

using uvertex = boost::graph_traits<ugraph>::vertex_descriptor

vertex definition.

Definition at line 1342 of file graph.hpp.

◆ UVertexIterator

using UVertexIterator = boost::graph_traits<ugraph>::vertex_iterator

vertex_iterator definition.

Definition at line 1351 of file graph.hpp.

◆ vertex

using vertex = boost::graph_traits<graph>::vertex_descriptor

vertex definition.

Definition at line 1303 of file graph.hpp.

◆ VertexIterator

using VertexIterator = boost::graph_traits<graph>::vertex_iterator

vertex_iterator definition.

Definition at line 1307 of file graph.hpp.

Function Documentation

◆ AbslHashValue()

template<typename H >
H AbslHashValue ( const H h,
const EdgeDescriptor m 
)

Definition at line 1337 of file graph.hpp.

◆ ADD_UEDGE()

template<class Graph >
void ADD_UEDGE ( typename boost::graph_traits< Graph >::vertex_descriptor  A,
typename boost::graph_traits< Graph >::vertex_descriptor  B,
int  selector,
Graph g 
)

Definition at line 1387 of file graph.hpp.

◆ Cget_edge_info()

template<class info_object , class Graph >
const info_object* Cget_edge_info ( typename boost::graph_traits< Graph >::edge_descriptor  e,
const Graph g 
)

Function returning the edge information associated with the specified edge.

This function does not modify the graph.

Parameters
vis the considered node.
gis the graph.
Returns
the edge_info object associated with v.

Definition at line 634 of file graph.hpp.

References THROW_ASSERT.

◆ Cget_node_info()

template<class info_object , class Graph >
const info_object* Cget_node_info ( typename boost::graph_traits< Graph >::vertex_descriptor  v,
const Graph g 
)

Function returning the node information associated with the specified node.

This function does not modify the graph.

Parameters
vis the considered node.
gis the graph.
Returns
the node_info object associated with v.

Definition at line 592 of file graph.hpp.

References THROW_ASSERT.

◆ Cget_node_infoRef()

template<class info_object , class Graph >
NodeInfoRef& Cget_node_infoRef ( typename boost::graph_traits< Graph >::vertex_descriptor  v,
Graph g 
)

Function returning the reference to the edge information associated with the specified edge.

This function modifies the graph if EdgeInfo is not yet associated with the edge.

Parameters
eis the considered edge.
gis the graph.
Returns
the reference to the EdgeInfo object associated with e.

Definition at line 535 of file graph.hpp.

◆ Cget_raw_edge_info()

template<class info_object , class Graph >
const info_object* Cget_raw_edge_info ( typename boost::graph_traits< Graph >::edge_descriptor  e,
const Graph g 
)

Function returning the edge information associated with the specified edge.

This function does not modify the graph.

Parameters
eis the considered edge.
gis the graph.
Returns
the edge_info object associated with e.

Definition at line 188 of file graph.hpp.

References THROW_ASSERT.

◆ CONSTREF_FORWARD_DECL() [1/8]

CONSTREF_FORWARD_DECL ( EdgeInfo  )

◆ CONSTREF_FORWARD_DECL() [2/8]

CONSTREF_FORWARD_DECL ( EdgeWriter  )

◆ CONSTREF_FORWARD_DECL() [3/8]

CONSTREF_FORWARD_DECL ( GraphWriter  )

◆ CONSTREF_FORWARD_DECL() [4/8]

CONSTREF_FORWARD_DECL ( NodeInfo  )

◆ CONSTREF_FORWARD_DECL() [5/8]

CONSTREF_FORWARD_DECL ( Parameter  )

◆ CONSTREF_FORWARD_DECL() [6/8]

CONSTREF_FORWARD_DECL ( UEdgeWriter  )

◆ CONSTREF_FORWARD_DECL() [7/8]

CONSTREF_FORWARD_DECL ( UVertexWriter  )

◆ CONSTREF_FORWARD_DECL() [8/8]

CONSTREF_FORWARD_DECL ( VertexWriter  )

◆ get_edge_info()

template<class info_object , class Graph >
info_object* get_edge_info ( typename boost::graph_traits< Graph >::edge_descriptor  e,
Graph g 
)

Function returning the edge information associated with the specified edge.

This function modifies the graph if EdgeInfo is not yet associated with the edge.

Parameters
eis the considered edge.
gis the graph.
Returns
the EdgeInfo object associated with e.

Note: reference has to be used since we want to modify the info associated with the edge

Definition at line 613 of file graph.hpp.

References THROW_ASSERT.

◆ get_node_info()

template<class info_object , class Graph >
info_object* get_node_info ( typename boost::graph_traits< Graph >::vertex_descriptor  v,
Graph g 
)

Function returning the node information associated with the specified node.

This function modifies the graph if NodeInfo is not yet associated with the node.

Parameters
vis the considered node.
gis the graph.
Returns
the NodeInfo object associated with v.

Definition at line 571 of file graph.hpp.

References THROW_ASSERT.

◆ get_raw_edge_info()

template<class info_object , class Graph >
info_object* get_raw_edge_info ( typename boost::graph_traits< Graph >::edge_descriptor  e,
Graph g 
)

Function returning the edge information associated with the specified edge.

This function modifies the graph if EdgeInfo is not yet associated with the edge.

Parameters
eis the considered edge.
gis the graph.
Returns
the EdgeInfo object associated with e.

Note: reference has to be used since we want to modify the info associated with the edge

Definition at line 167 of file graph.hpp.

References THROW_ASSERT.

◆ REF_FORWARD_DECL()

REF_FORWARD_DECL ( NodeInfo  )

◆ set_node_info()

template<class info_object , class Graph >
void set_node_info ( typename boost::graph_traits< Graph >::vertex_descriptor  v,
const refcount< info_object > &  obj,
Graph g 
)

Function returning the node information associated with the specified node.

This function modifies the graph if NodeInfo is not yet associated with the node.

Parameters
vis the considered node.
gis the graph.
Returns
the NodeInfo object associated with v.

Definition at line 553 of file graph.hpp.

◆ VERTEX() [1/2]

boost::graph_traits<graph>::vertex_descriptor VERTEX ( const boost::graph_traits< graph >::vertices_size_type  i,
const graph g 
)
inline

Given a filtered graph and an index returns the vertex exploiting the boost::vertex applied on the original graph.

this function can access the bulk graph

Parameters
iis the index of the vertex.
gis the graph for which the vertex is asked.
Returns
the vertex with the index i of the graph g.

Definition at line 1368 of file graph.hpp.

Referenced by graph::graph(), and ugraph::ugraph().

Here is the caller graph for this function:

◆ VERTEX() [2/2]

boost::graph_traits<ugraph>::vertex_descriptor VERTEX ( const boost::graph_traits< ugraph >::vertices_size_type  i,
const ugraph g 
)
inline

Given a filtered ugraph and an index returns the vertex exploiting the boost::vertex applied on the original graph.

this function can access the bulk graph

Parameters
iis the index of the vertex.
gis the ugraph for which the vertex is asked.
Returns
the vertex with the index i of the graph g.

Definition at line 1380 of file graph.hpp.


Generated on Mon Feb 12 2024 13:03:22 for PandA-2024.02 by doxygen 1.8.13