.. index:: pair: class; NGraph::tGraph .. _doxid-class_n_graph_1_1t_graph: template class NGraph::tGraph ============================= .. toctree:: :hidden: enum_NGraph_tGraph_line_type.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include template class tGraph { public: // typedefs typedef T :target:`vertex`; typedef T :target:`value_type`; typedef std::pair<:ref:`vertex`, :ref:`vertex`> :target:`edge`; typedef std::set<:ref:`vertex`> :target:`vertex_set`; typedef std::set<:ref:`edge`> :target:`edge_set`; typedef std::pair<:ref:`vertex_set`, :ref:`vertex_set`> :target:`in_out_edge_sets`; typedef std::map<:ref:`vertex`, :ref:`in_out_edge_sets`> :target:`adj_graph`; typedef edge_set::iterator :target:`edge_iterator`; typedef edge_set::const_iterator :target:`const_edge_iterator`; typedef vertex_set::iterator :target:`vertex_iterator`; typedef vertex_set::const_iterator :target:`const_vertex_iterator`; typedef vertex_set::iterator :target:`vertex_neighbor_iterator`; typedef vertex_set::const_iterator :target:`vertex_neighbor_const_iterator`; typedef adj_graph::iterator :ref:`iterator`; typedef adj_graph::const_iterator :target:`const_iterator`; typedef :ref:`iterator` :target:`node_iterator`; typedef :ref:`const_iterator` :target:`const_node_iterator`; // enums enum :ref:`line_type`; // construction :target:`tGraph`(); :target:`tGraph`(std::istream& s); :target:`tGraph`(const tGraph& B); :target:`tGraph`(const :ref:`edge_set`& E); // methods unsigned int :target:`num_vertices`() const; unsigned int :target:`num_nodes`() const; unsigned int :target:`num_edges`() const; :ref:`iterator` :target:`begin`(); :ref:`const_iterator` :target:`begin`() const; :ref:`iterator` :target:`end`(); :ref:`const_iterator` :target:`end`() const; void :target:`clear`(); :ref:`vertex_neighbor_iterator` :target:`out_neighbors_begin`(const :ref:`vertex`& a); :ref:`vertex_neighbor_const_iterator` :target:`out_neighbors_begin`(const :ref:`vertex`& a) const; :ref:`vertex_neighbor_iterator` :target:`out_neighbors_end`(const :ref:`vertex`& a); :ref:`vertex_neighbor_const_iterator` :target:`out_neighbors_end`(const :ref:`vertex`& a) const; bool :target:`is_undirected`() const; bool :target:`is_directed`() const; void :target:`set_undirected`(); :ref:`iterator` :target:`find`(const :ref:`vertex`& a); :ref:`const_iterator` :target:`find`(const :ref:`vertex`& a) const; const :ref:`vertex_set`& :target:`in_neighbors`(const :ref:`vertex`& a) const; :ref:`vertex_set`& :target:`in_neighbors`(const :ref:`vertex`& a); const :ref:`vertex_set`& :target:`out_neighbors`(const :ref:`vertex`& a) const; :ref:`vertex_set`& :target:`out_neighbors`(const :ref:`vertex`& a); unsigned int :target:`in_degree`(const :ref:`vertex`& a) const; unsigned int :target:`out_degree`(const :ref:`vertex`& a) const; unsigned int :target:`degree`(const :ref:`vertex`& a) const; bool :target:`isolated`(const :ref:`vertex`& a) const; void :target:`insert_vertex`(const :ref:`vertex`& a); void :target:`insert_new_vertex_inout_list`( const :ref:`vertex`& a, const :ref:`vertex_set`& IN, const :ref:`vertex_set`& OUT ); void :target:`insert_edge_noloop`(:ref:`iterator` pa, :ref:`iterator` pb); void :target:`insert_edge`(:ref:`iterator` pa, :ref:`iterator` pb); void :target:`insert_edge_noloop`(const :ref:`vertex`& a, const :ref:`vertex`& b); void :target:`insert_edge`(const :ref:`vertex`& a, const :ref:`vertex`& b); void :target:`insert_undirected_edge`(const :ref:`vertex`& a, const :ref:`vertex`& b); void :target:`insert_edge`(const :ref:`edge`& E); void :target:`insert_undirected_edge`(const :ref:`edge`& E); bool :target:`remove_edge`(:ref:`iterator` pa, :ref:`iterator` pb); void :target:`remove_edge`(const :ref:`vertex`& a, const :ref:`vertex`& b); void :target:`remove_edge`(const :ref:`edge`& E); void :target:`remove_undirected_edge`(const :ref:`vertex`& a, const :ref:`vertex`& b); void :target:`remove_undirected_edge`(const :ref:`edge`& e); void :target:`remove_vertex`(:ref:`iterator` pa); void :target:`remove_vertex_set`(const :ref:`vertex_set`& V); void :target:`remove_vertex`(const :ref:`vertex`& a); bool :ref:`includes_vertex`(const :ref:`vertex`& a) const; bool :ref:`includes_edge`(const :ref:`vertex`& a, const :ref:`vertex`& b) const; bool :target:`includes_edge`(const :ref:`edge`& e) const; std::vector<:ref:`edge`> :ref:`edge_list`() const; tGraph& :target:`plus_eq`(const tGraph& B); tGraph :target:`intersect`(const tGraph& B) const; tGraph :target:`operator *` (const tGraph& B) const; tGraph :target:`minus`(const tGraph& B) const; tGraph :target:`operator -` (const tGraph& B) const; tGraph :target:`plus`(const tGraph& B) const; tGraph :target:`operator +` (const tGraph& B) const; tGraph& :target:`operator +=` (const tGraph& B); tGraph :ref:`subgraph`(const :ref:`vertex_set`& A) const; unsigned int :target:`subgraph_size`(const :ref:`vertex_set`& A) const; double :target:`subgraph_sparsity`(const :ref:`vertex_set`& A) const; void :target:`print`() const; void :ref:`absorb`(:ref:`iterator` pa, :ref:`iterator` pb); :ref:`iterator` :ref:`smart_absorb`(:ref:`iterator` pa, :ref:`iterator` pb); :ref:`vertex` :target:`smart_absorb`(:ref:`vertex` a, :ref:`vertex` b); void :target:`absorb`(:ref:`vertex` a, :ref:`vertex` b); static const :ref:`vertex`& :ref:`node`(:ref:`const_iterator` p); static const :ref:`vertex`& :target:`node`(:ref:`iterator` p); static const :ref:`vertex`& :target:`node`(:ref:`const_vertex_iterator` p); static const :ref:`vertex_set`& :target:`in_neighbors`(:ref:`const_iterator` p); static :ref:`vertex_set`& :target:`in_neighbors`(:ref:`iterator` p); static :ref:`const_vertex_iterator` :target:`in_begin`(:ref:`const_iterator` p); static :ref:`const_vertex_iterator` :target:`in_end`(:ref:`const_iterator` p); static const :ref:`vertex_set`& :target:`out_neighbors`(:ref:`const_iterator` p); static :ref:`const_vertex_iterator` :target:`out_begin`(:ref:`const_iterator` p); static :ref:`const_vertex_iterator` :target:`out_end`(:ref:`const_iterator` p); static :ref:`vertex_set`& :target:`out_neighbors`(:ref:`iterator` p); static :ref:`vertex_iterator` :target:`out_begin`(:ref:`iterator` p); static unsigned int :target:`num_edges`(:ref:`const_iterator` p); static unsigned int :target:`num_edges`(:ref:`iterator` p); static unsigned int :ref:`out_degree`(:ref:`const_iterator` p); static unsigned int :target:`out_degree`(:ref:`iterator` p); static unsigned int :ref:`in_degree`(:ref:`const_iterator` p); static unsigned int :target:`in_degree`(:ref:`iterator` p); static unsigned int :target:`degree`(:ref:`const_iterator` p); static unsigned int :target:`degree`(:ref:`iterator` p); static bool :target:`isolated`(:ref:`const_iterator` p); static bool :target:`isolated`(:ref:`iterator` p); static std::istream& :target:`read_line`( std::istream& s, T& v1, T& v2, std::string& line, :ref:`line_type`& t ); }; // direct descendants class :ref:`ComputationalGraph`; .. _details-class_n_graph_1_1t_graph: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Typedefs -------- .. index:: pair: typedef; iterator .. _doxid-class_n_graph_1_1t_graph_1a6e446a33b74e5c0c39fb6c50a4f07cec: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef adj_graph::iterator iterator .. code-block:: cpp tGraph::iterator refers to pair . .. code-block:: none :ref:`tGraph::const_iterator ` p = G.begin(); .. code-block:: none :ref:`tGraph::vertex ` a = node(p); :ref:`tGraph::vertex_set ` &in_edges = in_neighbors(p); :ref:`tGraph::vertex_set ` &out_edges = out_neighbors(p); .. code-block:: none Methods ------- .. index:: pair: function; includes_vertex .. _doxid-class_n_graph_1_1t_graph_1a260849918a2806a4a9aa1cfad0471e41: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool includes_vertex(const :ref:`vertex`& a) const Is vertex 'a' included in graph? .. rubric:: Returns: true, if vertex a is present; false, otherwise. .. index:: pair: function; includes_edge .. _doxid-class_n_graph_1_1t_graph_1a463b923ee1e3604407837150f17f1a74: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool includes_edge(const :ref:`vertex`& a, const :ref:`vertex`& b) const Is edge (a,b) included in graph? .. rubric:: Returns: true, if edge is present; false, otherwise. .. index:: pair: function; edge_list .. _doxid-class_n_graph_1_1t_graph_1a4f7e150eadbb8845e8f858255022a037: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`edge`> edge_list() const Create a new representation of graph as a list of vertex pairs (a,b). .. rubric:: Returns: std::vector a vector (list) of vertex pairs .. index:: pair: function; subgraph .. _doxid-class_n_graph_1_1t_graph_1ab685e653704db79f06216d0d5977f153: .. ref-code-block:: cpp :class: doxyrest-title-code-block tGraph subgraph(const :ref:`vertex_set`& A) const .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - A - vertex set of nodes (subset of G) .. rubric:: Returns: a new subgraph containing all nodes of A .. index:: pair: function; absorb .. _doxid-class_n_graph_1_1t_graph_1a1844ff9c48370c79147c84384f400c80: .. ref-code-block:: cpp :class: doxyrest-title-code-block void absorb(:ref:`iterator` pa, :ref:`iterator` pb) abosrb(a,b): 'a' absorbs 'b', b gets removed from graph .. index:: pair: function; smart_absorb .. _doxid-class_n_graph_1_1t_graph_1aa3752935ebcd6e4688b52cd0f6d1211f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`iterator` smart_absorb(:ref:`iterator` pa, :ref:`iterator` pb) c smart_abosrb(a,b): 'a' absorbs 'b', or b aborbs a, depending on whichever causes the least amount of graph updates .. index:: pair: function; node .. _doxid-class_n_graph_1_1t_graph_1a826e79cbe8d540de7f044c6ae841dd5f: .. ref-code-block:: cpp :class: doxyrest-title-code-block static const :ref:`vertex`& node(:ref:`const_iterator` p) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - p - :ref:`tGraph::const_iterator ` .. index:: pair: function; out_degree .. _doxid-class_n_graph_1_1t_graph_1acd67259b93d9ec2de6ca03bf19e027bd: .. ref-code-block:: cpp :class: doxyrest-title-code-block static unsigned int out_degree(:ref:`const_iterator` p) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - p - :ref:`tGraph::const_iterator ` .. rubric:: Returns: number of edges going out (out-degree) at node pointed to by p. .. index:: pair: function; in_degree .. _doxid-class_n_graph_1_1t_graph_1a5c269fb5cb63c82496bb9c59d6c289b1: .. ref-code-block:: cpp :class: doxyrest-title-code-block static unsigned int in_degree(:ref:`const_iterator` p) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - p - :ref:`tGraph::const_iterator ` .. rubric:: Returns: number of edges going out (out-degree) at node pointed to by p.