Skip to content
Snippets Groups Projects
Select Git revision
  • 491e70ab7be74543f2ebc384845bc3b48c020162
  • master default protected
  • julia protected
  • 6.x protected
  • python-codegen
  • llvm-15
  • 5.x protected
  • 4.6 protected
  • uop
  • rework_pac
  • aux_vars_fix
  • julia-7.0.0
  • julia-6.4.0
  • julia-6.3.0
  • julia-6.2.0
15 results

MinimumFeedbackSet.hh

Blame
  • MinimumFeedbackSet.hh 4.32 KiB
    /*
     * Copyright (C) 2009-2010 Dynare Team
     *
     * This file is part of Dynare.
     *
     * Dynare is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * Dynare is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
     */
    
    #ifndef _MINIMUMFEEDBACKSET_HH
    #define _MINIMUMFEEDBACKSET_HH
    
    #include <map>
    #include <vector>
    #include <boost/graph/adjacency_list.hpp>
    
    using namespace std;
    using namespace boost;
    
    namespace MFS
    {
      typedef property<vertex_index_t, int,
                       property<vertex_index1_t, int,
                                property<vertex_degree_t, int,
                                         property<vertex_in_degree_t, int,
                                                  property<vertex_out_degree_t, int > > > > > VertexProperty_t;
      typedef adjacency_list<listS, listS, bidirectionalS, VertexProperty_t> AdjacencyList_t;
      typedef map<graph_traits<AdjacencyList_t>::vertex_descriptor, default_color_type> color_t;
      typedef vector<AdjacencyList_t::vertex_descriptor> vector_vertex_descriptor_t;
    
      //! Eliminate a vertex i
      /*! For a vertex i replace all edges e_k_i and e_i_j by a shorcut e_k_j and then Suppress the vertex i*/
      void Eliminate(AdjacencyList_t::vertex_descriptor vertex_to_eliminate, AdjacencyList_t &G);
      //! Collect all doublets (edges e_i_k such that there is an edge e_k_i with k!=i in the graph)
      /*! Returns the vector of doublets */
      vector_vertex_descriptor_t Collect_Doublet(AdjacencyList_t::vertex_descriptor vertex, AdjacencyList_t &G);
      //! Detect all the clique (all vertex in a clique are related to each other) in the graph
      bool Vertex_Belong_to_a_Clique(AdjacencyList_t::vertex_descriptor vertex, AdjacencyList_t &G);
      //! Graph reduction: eliminating purely intermediate variables or variables outside of any circuit
      bool Elimination_of_Vertex_With_One_or_Less_Indegree_or_Outdegree_Step(AdjacencyList_t &G);
      //! Graph reduction: elimination of a vertex inside a clique
      bool Elimination_of_Vertex_belonging_to_a_clique_Step(AdjacencyList_t &G);
      //! A vertex belong to the feedback vertex set if the vertex loops on itself.
      /*! We have to suppress this vertex and store it into the feedback set.*/
      bool Suppression_of_Vertex_X_if_it_loops_store_in_set_of_feedback_vertex_Step(set<int> &feed_back_vertices, AdjacencyList_t &G1);
      //! Print the Graph
      void Print(AdjacencyList_t &G);
      //! Create an adjacency graph from a Adjacency Matrix (an incidence Matrix without the diagonal terms)
      AdjacencyList_t AM_2_AdjacencyList(bool *AMp, unsigned int n);
      //! Extracts a subgraph
      /*!
        \param[in] G1 The original graph
        \param[in] select_index The vertex indices to select
        \return The subgraph
    
        The property vertex_index of the subgraph contains indices of the original
        graph, the property vertex_index1 contains new contiguous indices specific
        to the subgraph.
      */
      AdjacencyList_t extract_subgraph(AdjacencyList_t &G1, set<int> select_index);