NRP Core  1.4.1
NGraph::tGraph< T > Class Template Reference

#include <ngraph.hpp>

Public Types

enum  line_type { VERTEX, EDGE, COMMENT, EMPTY }
 
typedef T vertex
 
typedef T value_type
 
typedef std::pair< vertex, vertexedge
 
typedef std::set< vertexvertex_set
 
typedef std::set< edgeedge_set
 
typedef std::pair< vertex_set, vertex_setin_out_edge_sets
 
typedef std::map< vertex, in_out_edge_setsadj_graph
 
typedef edge_set::iterator edge_iterator
 
typedef edge_set::const_iterator const_edge_iterator
 
typedef vertex_set::iterator vertex_iterator
 
typedef vertex_set::const_iterator const_vertex_iterator
 
typedef vertex_set::iterator vertex_neighbor_iterator
 
typedef vertex_set::const_iterator vertex_neighbor_const_iterator
 
typedef adj_graph::iterator iterator
 
typedef adj_graph::const_iterator const_iterator
 
typedef iterator node_iterator
 
typedef const_iterator const_node_iterator
 

Public Member Functions

unsigned int num_vertices () const
 
unsigned int num_nodes () const
 
unsigned int num_edges () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void clear ()
 
vertex_neighbor_iterator out_neighbors_begin (const vertex &a)
 
vertex_neighbor_const_iterator out_neighbors_begin (const vertex &a) const
 
vertex_neighbor_iterator out_neighbors_end (const vertex &a)
 
vertex_neighbor_const_iterator out_neighbors_end (const vertex &a) const
 
 tGraph ()
 
 tGraph (std::istream &s)
 
 tGraph (const tGraph &B)
 
 tGraph (const edge_set &E)
 
bool is_undirected () const
 
bool is_directed () const
 
void set_undirected ()
 
iterator find (const vertex &a)
 
const_iterator find (const vertex &a) const
 
const vertex_setin_neighbors (const vertex &a) const
 
vertex_setin_neighbors (const vertex &a)
 
const vertex_setout_neighbors (const vertex &a) const
 
vertex_setout_neighbors (const vertex &a)
 
unsigned int in_degree (const vertex &a) const
 
unsigned int out_degree (const vertex &a) const
 
unsigned int degree (const vertex &a) const
 
bool isolated (const vertex &a) const
 
void insert_vertex (const vertex &a)
 
void insert_new_vertex_inout_list (const vertex &a, const vertex_set &IN, const vertex_set &OUT)
 
void insert_edge_noloop (iterator pa, iterator pb)
 
void insert_edge (iterator pa, iterator pb)
 
void insert_edge_noloop (const vertex &a, const vertex &b)
 
void insert_edge (const vertex &a, const vertex &b)
 
void insert_undirected_edge (const vertex &a, const vertex &b)
 
void insert_edge (const edge &E)
 
void insert_undirected_edge (const edge &E)
 
bool remove_edge (iterator pa, iterator pb)
 
void remove_edge (const vertex &a, const vertex &b)
 
void remove_edge (const edge &E)
 
void remove_undirected_edge (const vertex &a, const vertex &b)
 
void remove_undirected_edge (const edge &e)
 
void remove_vertex (iterator pa)
 
void remove_vertex_set (const vertex_set &V)
 
void remove_vertex (const vertex &a)
 
bool includes_vertex (const vertex &a) const
 
bool includes_edge (const vertex &a, const vertex &b) const
 
bool includes_edge (const edge &e) const
 
std::vector< edgeedge_list () const
 
tGraphplus_eq (const tGraph &B)
 
tGraph intersect (const tGraph &B) const
 
tGraph operator* (const tGraph &B) const
 
tGraph minus (const tGraph &B) const
 
tGraph operator- (const tGraph &B) const
 
tGraph plus (const tGraph &B) const
 
tGraph operator+ (const tGraph &B) const
 
tGraphoperator+= (const tGraph &B)
 
tGraph subgraph (const vertex_set &A) const
 
unsigned int subgraph_size (const vertex_set &A) const
 
double subgraph_sparsity (const vertex_set &A) const
 
void print () const
 
void absorb (iterator pa, iterator pb)
 
iterator smart_absorb (iterator pa, iterator pb)
 
vertex smart_absorb (vertex a, vertex b)
 
void absorb (vertex a, vertex b)
 

Static Public Member Functions

static const vertexnode (const_iterator p)
 
static const vertexnode (iterator p)
 
static const vertexnode (const_vertex_iterator p)
 
static const vertex_setin_neighbors (const_iterator p)
 
static vertex_setin_neighbors (iterator p)
 
static const_vertex_iterator in_begin (const_iterator p)
 
static const_vertex_iterator in_end (const_iterator p)
 
static const vertex_setout_neighbors (const_iterator p)
 
static const_vertex_iterator out_begin (const_iterator p)
 
static const_vertex_iterator out_end (const_iterator p)
 
static vertex_setout_neighbors (iterator p)
 
static vertex_iterator out_begin (iterator p)
 
static unsigned int num_edges (const_iterator p)
 
static unsigned int num_edges (iterator p)
 
static unsigned int out_degree (const_iterator p)
 
static unsigned int out_degree (iterator p)
 
static unsigned int in_degree (const_iterator p)
 
static unsigned int in_degree (iterator p)
 
static unsigned int degree (const_iterator p)
 
static unsigned int degree (iterator p)
 
static bool isolated (const_iterator p)
 
static bool isolated (iterator p)
 
static std::istream & read_line (std::istream &s, T &v1, T &v2, std::string &line, line_type &t)
 

Member Typedef Documentation

◆ adj_graph

template<typename T >
typedef std::map<vertex, in_out_edge_sets> NGraph::tGraph< T >::adj_graph

◆ const_edge_iterator

template<typename T >
typedef edge_set::const_iterator NGraph::tGraph< T >::const_edge_iterator

◆ const_iterator

template<typename T >
typedef adj_graph::const_iterator NGraph::tGraph< T >::const_iterator

◆ const_node_iterator

template<typename T >
typedef const_iterator NGraph::tGraph< T >::const_node_iterator

◆ const_vertex_iterator

template<typename T >
typedef vertex_set::const_iterator NGraph::tGraph< T >::const_vertex_iterator

◆ edge

template<typename T >
typedef std::pair<vertex,vertex> NGraph::tGraph< T >::edge

◆ edge_iterator

template<typename T >
typedef edge_set::iterator NGraph::tGraph< T >::edge_iterator

◆ edge_set

template<typename T >
typedef std::set<edge> NGraph::tGraph< T >::edge_set

◆ in_out_edge_sets

template<typename T >
typedef std::pair<vertex_set, vertex_set> NGraph::tGraph< T >::in_out_edge_sets

◆ iterator

template<typename T >
typedef adj_graph::iterator NGraph::tGraph< T >::iterator
  tGraph::iterator refers to pair<const vertex, in_out_edge_sets> .
      tGraph::const_iterator p = G.begin();
      tGraph::vertex a = node(p);
      tGraph::vertex_set  &in_edges = in_neighbors(p);
      tGraph::vertex_set  &out_edges = out_neighbors(p);
 

◆ node_iterator

template<typename T >
typedef iterator NGraph::tGraph< T >::node_iterator

◆ value_type

template<typename T >
typedef T NGraph::tGraph< T >::value_type

◆ vertex

template<typename T >
typedef T NGraph::tGraph< T >::vertex

◆ vertex_iterator

template<typename T >
typedef vertex_set::iterator NGraph::tGraph< T >::vertex_iterator

◆ vertex_neighbor_const_iterator

template<typename T >
typedef vertex_set::const_iterator NGraph::tGraph< T >::vertex_neighbor_const_iterator

◆ vertex_neighbor_iterator

template<typename T >
typedef vertex_set::iterator NGraph::tGraph< T >::vertex_neighbor_iterator

◆ vertex_set

template<typename T >
typedef std::set<vertex> NGraph::tGraph< T >::vertex_set

Member Enumeration Documentation

◆ line_type

template<typename T >
enum NGraph::tGraph::line_type
Enumerator
VERTEX 
EDGE 
COMMENT 
EMPTY 

Constructor & Destructor Documentation

◆ tGraph() [1/4]

template<typename T >
NGraph::tGraph< T >::tGraph ( )
inline

◆ tGraph() [2/4]

template<typename T >
NGraph::tGraph< T >::tGraph ( std::istream &  s)
inline

◆ tGraph() [3/4]

template<typename T >
NGraph::tGraph< T >::tGraph ( const tGraph< T > &  B)
inline

◆ tGraph() [4/4]

template<typename T >
NGraph::tGraph< T >::tGraph ( const edge_set E)
inline

Member Function Documentation

◆ absorb() [1/2]

template<typename T >
void NGraph::tGraph< T >::absorb ( iterator  pa,
iterator  pb 
)
inline

abosrb(a,b): 'a' absorbs 'b', b gets removed from graph

◆ absorb() [2/2]

template<typename T >
void NGraph::tGraph< T >::absorb ( vertex  a,
vertex  b 
)
inline

◆ begin() [1/2]

template<typename T >
iterator NGraph::tGraph< T >::begin ( )
inline

◆ begin() [2/2]

template<typename T >
const_iterator NGraph::tGraph< T >::begin ( ) const
inline

◆ clear()

template<typename T >
void NGraph::tGraph< T >::clear ( )
inline

◆ degree() [1/3]

template<typename T >
unsigned int NGraph::tGraph< T >::degree ( const vertex a) const
inline

◆ degree() [2/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::degree ( const_iterator  p)
inlinestatic

◆ degree() [3/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::degree ( iterator  p)
inlinestatic

◆ edge_list()

template<class T >
std::vector< typename tGraph< T >::edge > NGraph::tGraph< T >::edge_list

Create a new representation of graph as a list of vertex pairs (a,b).

Returns
std::vector<edge> a vector (list) of vertex pairs

◆ end() [1/2]

template<typename T >
iterator NGraph::tGraph< T >::end ( )
inline

◆ end() [2/2]

template<typename T >
const_iterator NGraph::tGraph< T >::end ( ) const
inline

◆ find() [1/2]

template<typename T >
iterator NGraph::tGraph< T >::find ( const vertex a)
inline

◆ find() [2/2]

template<typename T >
const_iterator NGraph::tGraph< T >::find ( const vertex a) const
inline

◆ in_begin()

template<typename T >
static const_vertex_iterator NGraph::tGraph< T >::in_begin ( const_iterator  p)
inlinestatic

◆ in_degree() [1/3]

template<typename T >
unsigned int NGraph::tGraph< T >::in_degree ( const vertex a) const
inline

◆ in_degree() [2/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::in_degree ( const_iterator  p)
inlinestatic
Parameters
ptGraph::const_iterator
Returns
number of edges going out (out-degree) at node pointed to by p.

◆ in_degree() [3/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::in_degree ( iterator  p)
inlinestatic

◆ in_end()

template<typename T >
static const_vertex_iterator NGraph::tGraph< T >::in_end ( const_iterator  p)
inlinestatic

◆ in_neighbors() [1/4]

template<typename T >
vertex_set& NGraph::tGraph< T >::in_neighbors ( const vertex a)
inline

◆ in_neighbors() [2/4]

template<typename T >
const vertex_set& NGraph::tGraph< T >::in_neighbors ( const vertex a) const
inline

◆ in_neighbors() [3/4]

template<typename T >
static const vertex_set& NGraph::tGraph< T >::in_neighbors ( const_iterator  p)
inlinestatic

◆ in_neighbors() [4/4]

template<typename T >
static vertex_set& NGraph::tGraph< T >::in_neighbors ( iterator  p)
inlinestatic

◆ includes_edge() [1/2]

template<typename T >
bool NGraph::tGraph< T >::includes_edge ( const edge e) const
inline

◆ includes_edge() [2/2]

template<typename T >
bool NGraph::tGraph< T >::includes_edge ( const vertex a,
const vertex b 
) const
inline

Is edge (a,b) included in graph?

Returns
true, if edge is present; false, otherwise.

◆ includes_vertex()

template<typename T >
bool NGraph::tGraph< T >::includes_vertex ( const vertex a) const
inline

Is vertex 'a' included in graph?

Returns
true, if vertex a is present; false, otherwise.

◆ insert_edge() [1/3]

template<typename T >
void NGraph::tGraph< T >::insert_edge ( const edge E)
inline

◆ insert_edge() [2/3]

template<typename T >
void NGraph::tGraph< T >::insert_edge ( const vertex a,
const vertex b 
)
inline

◆ insert_edge() [3/3]

template<typename T >
void NGraph::tGraph< T >::insert_edge ( iterator  pa,
iterator  pb 
)
inline

◆ insert_edge_noloop() [1/2]

template<typename T >
void NGraph::tGraph< T >::insert_edge_noloop ( const vertex a,
const vertex b 
)
inline

◆ insert_edge_noloop() [2/2]

template<typename T >
void NGraph::tGraph< T >::insert_edge_noloop ( iterator  pa,
iterator  pb 
)
inline

◆ insert_new_vertex_inout_list()

template<typename T >
void NGraph::tGraph< T >::insert_new_vertex_inout_list ( const vertex a,
const vertex_set IN,
const vertex_set OUT 
)
inline

◆ insert_undirected_edge() [1/2]

template<typename T >
void NGraph::tGraph< T >::insert_undirected_edge ( const edge E)
inline

◆ insert_undirected_edge() [2/2]

template<typename T >
void NGraph::tGraph< T >::insert_undirected_edge ( const vertex a,
const vertex b 
)
inline

◆ insert_vertex()

template<typename T >
void NGraph::tGraph< T >::insert_vertex ( const vertex a)
inline

◆ intersect()

template<typename T >
tGraph NGraph::tGraph< T >::intersect ( const tGraph< T > &  B) const
inline

◆ is_directed()

template<typename T >
bool NGraph::tGraph< T >::is_directed ( ) const
inline

◆ is_undirected()

template<typename T >
bool NGraph::tGraph< T >::is_undirected ( ) const
inline

◆ isolated() [1/3]

template<typename T >
bool NGraph::tGraph< T >::isolated ( const vertex a) const
inline

◆ isolated() [2/3]

template<typename T >
static bool NGraph::tGraph< T >::isolated ( const_iterator  p)
inlinestatic

◆ isolated() [3/3]

template<typename T >
static bool NGraph::tGraph< T >::isolated ( iterator  p)
inlinestatic

◆ minus()

template<typename T >
tGraph NGraph::tGraph< T >::minus ( const tGraph< T > &  B) const
inline

◆ node() [1/3]

template<typename T >
static const vertex& NGraph::tGraph< T >::node ( const_iterator  p)
inlinestatic

◆ node() [2/3]

template<typename T >
static const vertex& NGraph::tGraph< T >::node ( const_vertex_iterator  p)
inlinestatic

◆ node() [3/3]

template<typename T >
static const vertex& NGraph::tGraph< T >::node ( iterator  p)
inlinestatic

◆ num_edges() [1/3]

template<typename T >
unsigned int NGraph::tGraph< T >::num_edges ( ) const
inline

◆ num_edges() [2/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::num_edges ( const_iterator  p)
inlinestatic

◆ num_edges() [3/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::num_edges ( iterator  p)
inlinestatic

◆ num_nodes()

template<typename T >
unsigned int NGraph::tGraph< T >::num_nodes ( ) const
inline

◆ num_vertices()

template<typename T >
unsigned int NGraph::tGraph< T >::num_vertices ( ) const
inline

◆ operator*()

template<typename T >
tGraph NGraph::tGraph< T >::operator* ( const tGraph< T > &  B) const
inline

◆ operator+()

template<typename T >
tGraph NGraph::tGraph< T >::operator+ ( const tGraph< T > &  B) const
inline

◆ operator+=()

template<typename T >
tGraph& NGraph::tGraph< T >::operator+= ( const tGraph< T > &  B)
inline

◆ operator-()

template<typename T >
tGraph NGraph::tGraph< T >::operator- ( const tGraph< T > &  B) const
inline

◆ out_begin() [1/2]

template<typename T >
static const_vertex_iterator NGraph::tGraph< T >::out_begin ( const_iterator  p)
inlinestatic

◆ out_begin() [2/2]

template<typename T >
static vertex_iterator NGraph::tGraph< T >::out_begin ( iterator  p)
inlinestatic

◆ out_degree() [1/3]

template<typename T >
unsigned int NGraph::tGraph< T >::out_degree ( const vertex a) const
inline

◆ out_degree() [2/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::out_degree ( const_iterator  p)
inlinestatic
Parameters
ptGraph::const_iterator
Returns
number of edges going out (out-degree) at node pointed to by p.

◆ out_degree() [3/3]

template<typename T >
static unsigned int NGraph::tGraph< T >::out_degree ( iterator  p)
inlinestatic

◆ out_end()

template<typename T >
static const_vertex_iterator NGraph::tGraph< T >::out_end ( const_iterator  p)
inlinestatic

◆ out_neighbors() [1/4]

template<typename T >
vertex_set& NGraph::tGraph< T >::out_neighbors ( const vertex a)
inline

◆ out_neighbors() [2/4]

template<typename T >
const vertex_set& NGraph::tGraph< T >::out_neighbors ( const vertex a) const
inline

◆ out_neighbors() [3/4]

template<typename T >
static const vertex_set& NGraph::tGraph< T >::out_neighbors ( const_iterator  p)
inlinestatic

◆ out_neighbors() [4/4]

template<typename T >
static vertex_set& NGraph::tGraph< T >::out_neighbors ( iterator  p)
inlinestatic

◆ out_neighbors_begin() [1/2]

template<typename T >
vertex_neighbor_iterator NGraph::tGraph< T >::out_neighbors_begin ( const vertex a)
inline

◆ out_neighbors_begin() [2/2]

template<typename T >
vertex_neighbor_const_iterator NGraph::tGraph< T >::out_neighbors_begin ( const vertex a) const
inline

◆ out_neighbors_end() [1/2]

template<typename T >
vertex_neighbor_iterator NGraph::tGraph< T >::out_neighbors_end ( const vertex a)
inline

◆ out_neighbors_end() [2/2]

template<typename T >
vertex_neighbor_const_iterator NGraph::tGraph< T >::out_neighbors_end ( const vertex a) const
inline

◆ plus()

template<typename T >
tGraph NGraph::tGraph< T >::plus ( const tGraph< T > &  B) const
inline

◆ plus_eq()

template<typename T >
tGraph& NGraph::tGraph< T >::plus_eq ( const tGraph< T > &  B)
inline

◆ print()

template<typename T >
void NGraph::tGraph< T >::print

◆ read_line()

template<typename T >
static std::istream& NGraph::tGraph< T >::read_line ( std::istream &  s,
T &  v1,
T &  v2,
std::string &  line,
line_type t 
)
inlinestatic

◆ remove_edge() [1/3]

template<typename T >
void NGraph::tGraph< T >::remove_edge ( const edge E)
inline

◆ remove_edge() [2/3]

template<typename T >
void NGraph::tGraph< T >::remove_edge ( const vertex a,
const vertex b 
)
inline

◆ remove_edge() [3/3]

template<typename T >
bool NGraph::tGraph< T >::remove_edge ( iterator  pa,
iterator  pb 
)
inline

◆ remove_undirected_edge() [1/2]

template<typename T >
void NGraph::tGraph< T >::remove_undirected_edge ( const edge e)
inline

◆ remove_undirected_edge() [2/2]

template<typename T >
void NGraph::tGraph< T >::remove_undirected_edge ( const vertex a,
const vertex b 
)
inline

◆ remove_vertex() [1/2]

template<typename T >
void NGraph::tGraph< T >::remove_vertex ( const vertex a)
inline

◆ remove_vertex() [2/2]

template<typename T >
void NGraph::tGraph< T >::remove_vertex ( iterator  pa)
inline

◆ remove_vertex_set()

template<typename T >
void NGraph::tGraph< T >::remove_vertex_set ( const vertex_set V)
inline

◆ set_undirected()

template<typename T >
void NGraph::tGraph< T >::set_undirected ( )
inline

◆ smart_absorb() [1/2]

template<typename T >
iterator NGraph::tGraph< T >::smart_absorb ( iterator  pa,
iterator  pb 
)
inline

c smart_abosrb(a,b): 'a' absorbs 'b', or b aborbs a, depending on whichever causes the least amount of graph updates

◆ smart_absorb() [2/2]

template<typename T >
vertex NGraph::tGraph< T >::smart_absorb ( vertex  a,
vertex  b 
)
inline

◆ subgraph()

template<typename T >
tGraph NGraph::tGraph< T >::subgraph ( const vertex_set A) const
inline
Parameters
Avertex set of nodes (subset of G)
Returns
a new subgraph containing all nodes of A

◆ subgraph_size()

template<typename T >
unsigned int NGraph::tGraph< T >::subgraph_size ( const vertex_set A) const
inline

◆ subgraph_sparsity()

template<typename T >
double NGraph::tGraph< T >::subgraph_sparsity ( const vertex_set A) const
inline

The documentation for this class was generated from the following file: