|
Limbo 3.5.4
|
#include <GraphSimplification.h>
Public Types | |
| enum | vertex_status_type { GOOD , HIDDEN , MERGED } |
| status of vertex. More... | |
| enum | strategy_type { NONE = 0 , HIDE_SMALL_DEGREE = 1 , MERGE_SUBK4 = 2 , BICONNECTED_COMPONENT = 4 } |
| simplification strategies available. These strategies are order-sensitive. It is recommended to call simplify(), e.g. simplify(HIDE_SMALL_DEGREE | BICONNECTED_COMPONENT) More... | |
| typedef GraphType | graph_type |
| typedef boost::graph_traits< graph_type >::vertex_descriptor | graph_vertex_type |
| typedef boost::graph_traits< graph_type >::edge_descriptor | graph_edge_type |
| typedef boost::graph_traits< graph_type >::vertex_iterator | vertex_iterator |
| typedef boost::graph_traits< graph_type >::adjacency_iterator | adjacency_iterator |
| typedef boost::graph_traits< graph_type >::edge_iterator | edge_iterator |
Public Member Functions | |
| GraphSimplification (graph_type const &g, uint32_t color_num) | |
| GraphSimplification (GraphSimplification const &rhs) | |
| template<typename Iterator> | |
| void | precolor (Iterator first, Iterator last) |
| std::vector< vertex_status_type > const & | status () const |
| std::vector< graph_vertex_type > const & | parents () const |
| std::vector< std::vector< graph_vertex_type > > const & | children () const |
| std::stack< graph_vertex_type > const & | hidden_vertices () const |
| std::pair< graph_type, std::map< graph_vertex_type, graph_vertex_type > > | simplified_graph () const |
| bool | simplified_graph_component (uint32_t comp_id, graph_type &sg, std::vector< graph_vertex_type > &vSimpl2Orig) const |
| uint32_t | num_component () const |
| added by Qi Sun, also get the original edge relationships | |
| void | get_CompVertex (std::vector< std::vector< graph_vertex_type > > &CompVertex) |
| added by Qi Sun, to get m_mCompVertex | |
| void | max_merge_level (int32_t l) |
| void | simplify (uint32_t level) |
| void | recover (std::vector< int8_t > &vColorFlat, std::vector< std::vector< int8_t > > &mColor, std::vector< std::vector< graph_vertex_type > > const &mSimpl2Orig) const |
| void | set_isVDDGND (std::set< graph_vertex_type > vdd_set) |
| construct m_isVDDGND | |
| void | set_isHiden (std::set< graph_vertex_type > is_hidens) |
| bool | whether_VDDGND (graph_vertex_type id) |
| return whether vertex with 'id' is VDDGND | |
| void | merge_subK4 () |
| void | hide_small_degree () |
| hide vertices whose degree is no larger than number of colors - 1 | |
| void | biconnected_component () |
| find all articulation points and biconnected components | |
| void | mergeVDD (std::set< graph_vertex_type > vdd_set) |
| added by Qi Sun, used to merge VDD nodes | |
| void | recover_merge_subK4 (std::vector< int8_t > &vColor) const |
| void | recover_biconnected_component (std::vector< std::vector< int8_t > > &mColor, std::vector< std::vector< graph_vertex_type > > const &mSimpl2Orig) const |
| recover color for biconnected components | |
| void | recover_hide_small_degree (std::vector< int8_t > &vColor) |
| void | write_graph_dot (std::string const &filename) const |
| void | write_simplified_graph_dot (std::string const &filename) const |
| bool | articulation_point (graph_vertex_type v) const |
| void | get_articulations (std::vector< graph_vertex_type > &art_vec) |
Protected Member Functions | |
| void | biconnected_component_recursion (graph_vertex_type v, std::deque< bool > &vVisited, std::vector< uint32_t > &vDisc, std::vector< uint32_t > &vLow, std::vector< graph_vertex_type > &vParent, uint32_t &visit_time, std::stack< std::pair< graph_vertex_type, graph_vertex_type > > &vEdge, std::list< std::pair< graph_vertex_type, std::set< graph_vertex_type > > > &mCompVertex) const |
| void | connected_component () |
| compute connected components | |
| graph_vertex_type | parent (graph_vertex_type v) const |
| graph_vertex_type | parent (uint32_t v, std::vector< uint32_t > const &vParent) const |
| bool | connected_conflict (graph_vertex_type v1, graph_vertex_type v2) const |
| bool | connected_stitch (graph_vertex_type v1, graph_vertex_type v2) const |
| std::pair< graph_edge_type, bool > | connected_edge (graph_vertex_type v1, graph_vertex_type v2) const |
| bool | merged (graph_vertex_type v1) const |
| bool | good (graph_vertex_type v1) const |
| bool | hidden (graph_vertex_type v1) const |
| bool | precolored (graph_vertex_type v1) const |
| bool | has_precolored () const |
| bool | check_max_merge_level (uint32_t l) const |
Protected Attributes | |
| graph_type const & | m_graph |
| original graph | |
| uint32_t | m_color_num |
| number of colors | |
| uint32_t | m_level |
| simplification level | |
| uint32_t | m_max_merge_level |
| in MERGE_SUBK4, any merge that results in the children number of a vertex larger than m_max_merge_level is disallowed | |
| std::vector< vertex_status_type > | m_vStatus |
| status of each vertex | |
| std::vector< graph_vertex_type > | m_vParent |
| parent vertex of current vertex | |
| std::vector< std::vector< graph_vertex_type > > | m_vChildren |
| children verices of current vertex, a vertex is the child of itself if it is not merged | |
| std::stack< graph_vertex_type > | m_vHiddenVertex |
| a std::stack that keeps a reverse order of vertices hidden, useful for color recovery | |
| std::vector< std::vector< graph_vertex_type > > | m_mCompVertex |
| group vertices by components | |
| std::map< graph_vertex_type, std::set< uint32_t > > | m_mArtiPoint |
| map of (vertex of articulation point, set of components split by the vertex) | |
| std::vector< int8_t > | m_vPrecolor |
| precolor information, if uncolored, std::set to -1 | |
| std::vector< bool > | m_isVDDGND |
| used in graph simplification, whether it's VDDGND, added by Qi Sun | |
Various graph simplification techniques for graph coloring.
| GraphType | graph type |
Definition at line 50 of file GraphSimplification.h.
| typedef boost::graph_traits<graph_type>::adjacency_iterator limbo::algorithms::coloring::GraphSimplification< GraphType >::adjacency_iterator |
Definition at line 58 of file GraphSimplification.h.
| typedef boost::graph_traits<graph_type>::edge_iterator limbo::algorithms::coloring::GraphSimplification< GraphType >::edge_iterator |
Definition at line 59 of file GraphSimplification.h.
| typedef boost::graph_traits<graph_type>::edge_descriptor limbo::algorithms::coloring::GraphSimplification< GraphType >::graph_edge_type |
Definition at line 56 of file GraphSimplification.h.
| typedef GraphType limbo::algorithms::coloring::GraphSimplification< GraphType >::graph_type |
Definition at line 54 of file GraphSimplification.h.
| typedef boost::graph_traits<graph_type>::vertex_descriptor limbo::algorithms::coloring::GraphSimplification< GraphType >::graph_vertex_type |
Definition at line 55 of file GraphSimplification.h.
| typedef boost::graph_traits<graph_type>::vertex_iterator limbo::algorithms::coloring::GraphSimplification< GraphType >::vertex_iterator |
Definition at line 57 of file GraphSimplification.h.
| enum limbo::algorithms::coloring::GraphSimplification::strategy_type |
simplification strategies available. These strategies are order-sensitive.
It is recommended to call simplify(), e.g. simplify(HIDE_SMALL_DEGREE | BICONNECTED_COMPONENT)
Definition at line 72 of file GraphSimplification.h.
| enum limbo::algorithms::coloring::GraphSimplification::vertex_status_type |
status of vertex.
| Enumerator | |
|---|---|
| GOOD | still in graph |
| HIDDEN | vertex is hidden by simplification |
| MERGED | vertex is merged to other vertex |
Definition at line 63 of file GraphSimplification.h.
|
inline |
constructor
| g | graph |
| color_num | number of colors |
Definition at line 81 of file GraphSimplification.h.
| limbo::algorithms::coloring::GraphSimplification< GraphType >::GraphSimplification | ( | GraphSimplification< GraphType > const & | rhs | ) |
copy constructor is not allowed
| rhs | a GraphSimplification object |
|
inline |
| v | vertex |
Definition at line 214 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::biconnected_component | ( | ) |
find all articulation points and biconnected components
Definition at line 890 of file GraphSimplification.h.
|
protected |
recursive implementation of computing biconnected components
| v | current vertex |
| vVisited | an array records whether a vertex has been visited |
| vDisc | discovery time of vertices |
| vLow | low values of vertices |
| vParent | parents of vertices |
| visit_time | records current visiting time |
| vEdge | a stack of edges for DFS |
| mCompVertex | vertices arranged by independent components |
Definition at line 1005 of file GraphSimplification.h.
|
inlineprotected |
| l | merge level |
Definition at line 362 of file GraphSimplification.h.
|
inline |
Definition at line 129 of file GraphSimplification.h.
|
protected |
compute connected components
Definition at line 1094 of file GraphSimplification.h.
|
inlineprotected |
| v1 | vertex |
| v2 | vertex |
Definition at line 270 of file GraphSimplification.h.
|
inlineprotected |
| v1 | vertex |
| v2 | vertex |
Definition at line 306 of file GraphSimplification.h.
|
inlineprotected |
| v1 | vertex |
| v2 | vertex |
Definition at line 288 of file GraphSimplification.h.
|
inline |
Definition at line 218 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::get_CompVertex | ( | std::vector< std::vector< graph_vertex_type > > & | CompVertex | ) |
added by Qi Sun, to get m_mCompVertex
Definition at line 449 of file GraphSimplification.h.
|
inlineprotected |
| v1 | vertex |
Definition at line 334 of file GraphSimplification.h.
|
inlineprotected |
Definition at line 351 of file GraphSimplification.h.
|
inlineprotected |
| v1 | vertex |
Definition at line 340 of file GraphSimplification.h.
|
inline |
Definition at line 131 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::hide_small_degree | ( | ) |
hide vertices whose degree is no larger than number of colors - 1
hide vertices whose degree is no larger than color_num-1
Definition at line 816 of file GraphSimplification.h.
|
inline |
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::merge_subK4 | ( | ) |
For a structure of K4 with one fewer edge,
suppose we have 4 vertices 1, 2, 3, 4, edges 1–2, 1–3, 2–3, 2–4, 3–4. Vertex 4 is merged to 1. This strategy only works for 3-coloring. It cannot guarantee minimal conflicts, but it can be used in a native conflict checker.
for a structure of K4 with one fewer edge suppose we have 4 vertices 1, 2, 3, 4 1–2, 1–3, 2–3, 2–4, 3–4, vertex 4 is merged to 1 this strategy only works for 3-coloring it cannot guarantee minimal conflicts but it can be used in a native conflict checker
Definition at line 707 of file GraphSimplification.h.
|
inlineprotected |
| v1 | vertex |
Definition at line 322 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::mergeVDD | ( | std::set< graph_vertex_type > | vdd_set | ) |
added by Qi Sun, used to merge VDD nodes
Definition at line 602 of file GraphSimplification.h.
|
inline |
added by Qi Sun, also get the original edge relationships
Definition at line 146 of file GraphSimplification.h.
|
inlineprotected |
| v | vertex |
Definition at line 248 of file GraphSimplification.h.
|
inlineprotected |
| v | vertex |
| vParent | parent array of vertices |
Definition at line 261 of file GraphSimplification.h.
|
inline |
Definition at line 127 of file GraphSimplification.h.
|
inline |
set precolored vertices
| Iterator | iterator type |
| first,last | begin and end of the precolored vertex array |
Definition at line 116 of file GraphSimplification.h.
|
inlineprotected |
| v1 | vertex |
Definition at line 346 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::recover | ( | std::vector< int8_t > & | vColorFlat, |
| std::vector< std::vector< int8_t > > & | mColor, | ||
| std::vector< std::vector< graph_vertex_type > > const & | mSimpl2Orig ) const |
API to recover coloring solutions from color assignment of simplified graph
| vColorFlat | flatten coloring solutions for original graph |
| mColor | coloring solutions arranged by components |
| mSimpl2Orig | mapping from simplified graph components to original graph |
Definition at line 668 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::recover_biconnected_component | ( | std::vector< std::vector< int8_t > > & | mColor, |
| std::vector< std::vector< graph_vertex_type > > const & | mSimpl2Orig ) const |
recover color for biconnected components
recover color for biconnected components
| mColor | coloring solutions arranged by components |
| mSimpl2Orig | mapping from simplified graph components to original graph |
Definition at line 1229 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::recover_hide_small_degree | ( | std::vector< int8_t > & | vColor | ) |
recover color for hidden vertices need to be called manually, no density balance considered this function is mutable because it pops out elements in m_vHiddenVertex
| vColor | coloring solutions, it must be partially assigned colors except simplified vertices |
Definition at line 1346 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::recover_merge_subK4 | ( | std::vector< int8_t > & | vColor | ) | const |
recover merged vertices
| vColor | must be partially assigned colors except simplified vertices |
Definition at line 1208 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::set_isHiden | ( | std::set< graph_vertex_type > | is_hidens | ) |
Definition at line 595 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::set_isVDDGND | ( | std::set< graph_vertex_type > | vdd_set | ) |
construct m_isVDDGND
Definition at line 588 of file GraphSimplification.h.
| std::pair< typename GraphSimplification< GraphType >::graph_type, std::map< typename GraphSimplification< GraphType >::graph_vertex_type, typename GraphSimplification< GraphType >::graph_vertex_type > > limbo::algorithms::coloring::GraphSimplification< GraphType >::simplified_graph | ( | ) | const |
Definition at line 391 of file GraphSimplification.h.
| bool limbo::algorithms::coloring::GraphSimplification< GraphType >::simplified_graph_component | ( | uint32_t | comp_id, |
| graph_type & | sg, | ||
| std::vector< graph_vertex_type > & | vSimpl2Orig ) const |
extract a component from simplified graph
| comp_id | component id |
| sg | component of simplified graph |
| vSimpl2Orig | mapping from simplified graph to original graph |
Definition at line 464 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::simplify | ( | uint32_t | level | ) |
API to run the simplification algorithm
| level | simplification level, can be combination of items in limbo::algorithms::coloring::GraphSimplification::strategy_type |
Definition at line 623 of file GraphSimplification.h.
|
inline |
Definition at line 125 of file GraphSimplification.h.
| bool limbo::algorithms::coloring::GraphSimplification< GraphType >::whether_VDDGND | ( | graph_vertex_type | id | ) |
return whether vertex with 'id' is VDDGND
Definition at line 458 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::write_graph_dot | ( | std::string const & | filename | ) | const |
write graph in graphviz format
| filename | output file name |
Definition at line 1403 of file GraphSimplification.h.
| void limbo::algorithms::coloring::GraphSimplification< GraphType >::write_simplified_graph_dot | ( | std::string const & | filename | ) | const |
write simplified graph in graphviz format
| filename | output file name |
Definition at line 1465 of file GraphSimplification.h.
|
protected |
number of colors
Definition at line 367 of file GraphSimplification.h.
|
protected |
original graph
Definition at line 366 of file GraphSimplification.h.
|
protected |
used in graph simplification, whether it's VDDGND, added by Qi Sun
Definition at line 385 of file GraphSimplification.h.
|
protected |
simplification level
Definition at line 368 of file GraphSimplification.h.
|
protected |
map of (vertex of articulation point, set of components split by the vertex)
Definition at line 381 of file GraphSimplification.h.
|
protected |
in MERGE_SUBK4, any merge that results in the children number of a vertex larger than m_max_merge_level is disallowed
Definition at line 369 of file GraphSimplification.h.
|
protected |
group vertices by components
Definition at line 377 of file GraphSimplification.h.
|
protected |
children verices of current vertex, a vertex is the child of itself if it is not merged
Definition at line 373 of file GraphSimplification.h.
|
protected |
a std::stack that keeps a reverse order of vertices hidden, useful for color recovery
Definition at line 375 of file GraphSimplification.h.
|
protected |
parent vertex of current vertex
Definition at line 372 of file GraphSimplification.h.
|
protected |
precolor information, if uncolored, std::set to -1
Definition at line 383 of file GraphSimplification.h.
|
protected |
status of each vertex
Definition at line 370 of file GraphSimplification.h.