ModErn Text Analysis
META Enumerates Textual Applications
Public Types | Public Member Functions | Protected Attributes | List of all members
meta::graph::graph< Node, Edge > Class Template Referenceabstract
Inheritance diagram for meta::graph::graph< Node, Edge >:
meta::graph::directed_graph< Node, Edge > meta::graph::undirected_graph< Node, Edge >

Public Types

using adjacency_list = std::vector< std::pair< node_id, Edge >>
 

Public Member Functions

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
 
virtual node_id insert (Node node)=0
 
template<class... Args>
node_id emplace (Args &&...args)
 Constructs a node with forwarded arguments. More...
 
virtual void add_edge (Edge edge, node_id source, node_id dest)=0
 
virtual void add_edge (node_id source, node_id dest)
 Adds a default edge between the two nodes. More...
 

Protected Attributes

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.
 

Member Function Documentation

template<class Node , class Edge >
Node & meta::graph::graph< Node, Edge >::node ( node_id  id)
virtual
Parameters
id
Returns
the Node object that the id represents
template<class Node , class Edge >
util::optional< Edge > meta::graph::graph< Node, Edge >::edge ( node_id  source,
node_id  dest 
) const
virtual
Parameters
source
dest
Returns
an optional edge connecting source and dest
template<class Node , class Edge >
uint64_t meta::graph::graph< Node, Edge >::size ( ) const
virtual
Returns
the size of this graph (number of nodes), which is the range for a valid node_id
template<class Node , class Edge >
uint64_t meta::graph::graph< Node, Edge >::num_edges ( ) const
virtual
Returns
the number of edges in the graph
template<class Node, class Edge>
virtual node_id meta::graph::graph< Node, Edge >::insert ( Node  node)
pure virtual
Parameters
nodeThe new object to add into the graph
Returns
the id of the inserted node

Implemented in meta::graph::directed_graph< Node, Edge >, and meta::graph::undirected_graph< Node, Edge >.

template<class Node , class Edge >
template<class... Args>
node_id meta::graph::graph< Node, Edge >::emplace ( Args &&...  args)

Constructs a node with forwarded arguments.

Returns
the id of the inserted node
template<class Node, class Edge>
virtual void meta::graph::graph< Node, Edge >::add_edge ( Edge  edge,
node_id  source,
node_id  dest 
)
pure virtual
template<class Node , class Edge>
void meta::graph::graph< Node, Edge >::add_edge ( node_id  source,
node_id  dest 
)
virtual

Adds a default edge between the two nodes.

Parameters
source
dest

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