ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
meta::graph::directed_graph< Node, Edge > Class Template Reference

A (currently) simple class to represent a directed graph in memory. More...

#include <directed_graph.h>

Inheritance diagram for meta::graph::directed_graph< Node, Edge >:
meta::graph::graph< Node, Edge >

Classes

class  edge_iterator
 
class  node_iterator
 
class  undirected_graph
 

Public Types

using adjacency_list = typename graph< Node, Edge >::adjacency_list
 
using vec_t = std::vector< std::pair< Node, adjacency_list >>
 
typedef node_iterator< typename vec_t::iterator > iterator
 
typedef node_iterator< typename vec_t::const_iterator > const_iterator
 
typedef edge_iterator< typename vec_t::iterator > e_iterator
 
typedef edge_iterator< typename vec_t::const_iterator > const_e_iterator
 
- Public Types inherited from meta::graph::graph< Node, Edge >
using adjacency_list = std::vector< std::pair< node_id, Edge >>
 

Public Member Functions

const adjacency_list & adjacent (node_id id) const
 
const std::vector< node_id > & incoming (node_id id) const
 
virtual node_id insert (Node node) override
 
virtual void add_edge (Edge edge, node_id source, node_id dest) override
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
e_iterator edges_begin ()
 
const_e_iterator edges_begin () const
 
e_iterator edges_end ()
 
const_e_iterator edges_end () const
 
- Public Member Functions inherited from meta::graph::graph< Node, Edge >
virtual Node & node (node_id id)
 
virtual const Node & node (node_id id) const
 
virtual util::optional< Edge > edge (node_id source, node_id dest) const
 
virtual uint64_t size () const
 
virtual uint64_t num_edges () const
 
template<class... Args>
node_id emplace (Args &&...args)
 Constructs a node with forwarded arguments. More...
 
virtual void add_edge (node_id source, node_id dest)
 Adds a default edge between the two nodes. More...
 

Private Attributes

std::vector< std::vector< node_id > > incoming_
 Each Node object is indexed by its id. More...
 

Additional Inherited Members

- Protected Attributes inherited from meta::graph::graph< Node, Edge >
std::vector< std::pair< Node, adjacency_list > > nodes_
 Each Node object is indexed by its id.
 
uint64_t num_edges_ = 0
 Saves the number of edges in this graph.
 

Detailed Description

template<class Node = default_node, class Edge = default_edge>
class meta::graph::directed_graph< Node, Edge >

A (currently) simple class to represent a directed graph in memory.

Member Function Documentation

template<class Node , class Edge >
auto directed_graph< Node, Edge >::adjacent ( node_id  id) const
Parameters
idThe node id to get outgoing nodes from
Returns
the outgoing edges and node_ids to the given node
template<class Node , class Edge >
const std::vector< node_id > & directed_graph< Node, Edge >::incoming ( node_id  id) const
Parameters
idThe node id to get incoming nodes to
Returns
a collection of node_ids that are incoming to the parameter node
template<class Node , class Edge >
node_id directed_graph< Node, Edge >::insert ( Node  node)
overridevirtual
Parameters
nodeThe new object to add into the graph
Returns
the id of the inserted node

Implements meta::graph::graph< Node, Edge >.

template<class Node , class Edge >
void directed_graph< Node, Edge >::add_edge ( Edge  edge,
node_id  source,
node_id  dest 
)
overridevirtual
Parameters
edge
source
dest

Implements meta::graph::graph< Node, Edge >.

template<class Node = default_node, class Edge = default_edge>
iterator meta::graph::directed_graph< Node, Edge >::begin ( )
inline
Returns
an iterator to the beginning ("first" node) of this graph
template<class Node = default_node, class Edge = default_edge>
iterator meta::graph::directed_graph< Node, Edge >::end ( )
inline
Returns
an iterator that represents one past the last node of this graph
template<class Node = default_node, class Edge = default_edge>
e_iterator meta::graph::directed_graph< Node, Edge >::edges_begin ( )
inline
Returns
an iterator to the beginning ("first" edge) of this graph
template<class Node = default_node, class Edge = default_edge>
e_iterator meta::graph::directed_graph< Node, Edge >::edges_end ( )
inline
Returns
an iterator that represents one past the last node of this graph

Member Data Documentation

template<class Node = default_node, class Edge = default_edge>
std::vector<std::vector<node_id> > meta::graph::directed_graph< Node, Edge >::incoming_
private

Each Node object is indexed by its id.

This structure keeps track of incoming nodes to a specific node_id.


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