Home | Documentation | Download | Platforms | Projects | Mailing Lists | Version History
Public Types | |
typedef int | side_type |
typedef short int | fix_type |
typedef list< edge > ::const_iterator | cut_edges_iterator |
typedef list< node > ::const_iterator | nodes_of_one_side_iterator |
Public Member Functions | |
fm_partition () | |
virtual | ~fm_partition () |
void | set_vars (const graph &G, const node_map< int > &node_weight, const edge_map< int > &edge_weight) |
void | set_vars (const graph &G, const node_map< int > &node_weight, const edge_map< int > &edge_weight, const node_map< side_type > &init_side) |
void | set_vars (const graph &G, const node_map< int > &node_weight, const edge_map< int > &edge_weight, const node_map< fix_type > &fixed) |
void | set_vars (const graph &G, const node_map< int > &node_weight, const edge_map< int > &edge_weight, const node_map< side_type > &init_side, const node_map< fix_type > &fixed) |
void | store_cut_edges (const bool set) |
void | store_nodesAB (const bool set) |
virtual int | check (graph &G) |
int | run (graph &G) |
int | get_cutsize () |
int | get_needed_passes () |
side_type | get_side_of_node (const node &n) const |
side_type | operator[] (const node &n) const |
int | get_weight_on_sideA (const graph &G) const |
int | get_weight_on_sideB (const graph &G) const |
cut_edges_iterator | cut_edges_begin () const |
cut_edges_iterator | cut_edges_end () const |
nodes_of_one_side_iterator | nodes_of_sideA_begin () const |
nodes_of_one_side_iterator | nodes_of_sideA_end () const |
nodes_of_one_side_iterator | nodes_of_sideB_begin () const |
nodes_of_one_side_iterator | nodes_of_sideB_end () const |
virtual void | reset () |
Static Public Attributes | |
static const side_type | A |
static const side_type | B |
static const fix_type | FIXA |
static const fix_type | FIXB |
static const fix_type | UNFIXED |
This class implements a heuristic graph bi-partitioning algorithm, based on iterative movement, proposed by C. M. Fiduccia and R. M. Mattheyses in 1982.
In the case E is the set of edges of the graph, the algorithm needs O(|E|)
time to proceed.
typedef int fm_partition::side_type |
typedef short int fm_partition::fix_type |
Fix type of each node (needed with fm_partition::set_vars).
typedef list<edge>::const_iterator fm_partition::cut_edges_iterator |
Iterator type for edges which belong to the cut.
typedef list<node>::const_iterator fm_partition::nodes_of_one_side_iterator |
Iterator type of nodes of a side.
fm_partition::fm_partition | ( | ) |
Default constructor.
virtual fm_partition::~fm_partition | ( | ) | [virtual] |
void fm_partition::set_vars | ( | const graph & | G, | |
const node_map< int > & | node_weight, | |||
const edge_map< int > & | edge_weight | |||
) |
void fm_partition::set_vars | ( | const graph & | G, | |
const node_map< int > & | node_weight, | |||
const edge_map< int > & | edge_weight, | |||
const node_map< side_type > & | init_side | |||
) |
Sets variables. Must be executed before fm_partition::check! In order to get good results, init_side
should almost be in balance.
G | undirected graph | |
node_weight | weight of each node | |
edge_weight | weight of each edge | |
init_side | initial bi-partitioning |
void fm_partition::set_vars | ( | const graph & | G, | |
const node_map< int > & | node_weight, | |||
const edge_map< int > & | edge_weight, | |||
const node_map< fix_type > & | fixed | |||
) |
Sets variables. Must be executed before fm_partition::check!
G | undirected graph | |
node_weight | weight of each node | |
edge_weight | weight of each edge | |
fixed | fixed nodes |
void fm_partition::set_vars | ( | const graph & | G, | |
const node_map< int > & | node_weight, | |||
const edge_map< int > & | edge_weight, | |||
const node_map< side_type > & | init_side, | |||
const node_map< fix_type > & | fixed | |||
) |
Sets variables. Must be executed before fm_partition::check! In order to get good results, init_side
should almost be in balance. Fixed nodes are on their fix side, their initial side is overwritten then.
G | undirected graph | |
node_weight | weight of each node | |
edge_weight | weight of each edge | |
init_side | initial bi-partitioning | |
fixed | fixed nodes |
void fm_partition::store_cut_edges | ( | const bool | set | ) |
Enables the storing of cut-edges. If enabled the list of cut-edges can be traversed using fm_partition::cut_edges_iterator.
set | if true cut_edges will be stored |
void fm_partition::store_nodesAB | ( | const bool | set | ) |
Enables the storing of nodes on their side. If enabled the nodes of each side can be traversed using fm_partition::nodes_on_one_side_iterator.
set | if true nodes will be stored on their sides |
virtual int fm_partition::check | ( | graph & | G | ) | [virtual] |
Checks whether following preconditions are satisfied:
G
is undirected.
G | graph |
algorithm::GTL_OK
on success, algorithm::GTL_ERROR
otherwise Implements algorithm.
int fm_partition::run | ( | graph & | G | ) | [virtual] |
Computes a partitioning with G
, that means a division of its vertices in two sides fm_partition::A
and fm_partition::B
.
G | graph |
algorithm::GTL_OK
on success, algorithm::GTL_ERROR
otherwise Implements algorithm.
int fm_partition::get_cutsize | ( | ) |
Gets the size of the cut after bi-partitioning.
int fm_partition::get_needed_passes | ( | ) |
Gets the number of passes needed to create a bi-partition with this heuristic.
Gets side of the node after bi-partitioning.
fm_partition::A
if n
lies on side A
, fm_partition::B
otherwise Gets side of the node after bi-partitioning.
fm_partition::A
if n
lies on side A
, fm_partition::B
otherwise int fm_partition::get_weight_on_sideA | ( | const graph & | G | ) | const |
int fm_partition::get_weight_on_sideB | ( | const graph & | G | ) | const |
cut_edges_iterator fm_partition::cut_edges_begin | ( | ) | const |
Iterate through all edges which belong to the cut, that means all edges with end-nodes on different sides. It is only valid if enabled with fm_partition::store_cut_edges before.
cut_edges_iterator fm_partition::cut_edges_end | ( | ) | const |
End-Iterator for iteration through all edges which belong to the cut. It is only valid if enabled with fm_partition::store_cut_edges before.
nodes_of_one_side_iterator fm_partition::nodes_of_sideA_begin | ( | ) | const |
Iterate through all nodes which belong to side A
. It is only valid if enabled with fm_partition::store_nodesAB before.
A
nodes_of_one_side_iterator fm_partition::nodes_of_sideA_end | ( | ) | const |
End-Iterator for iteration through all nodes which belong to side A
. It is only valid if enabled with fm_partition::store_nodesAB before.
A
nodes_of_one_side_iterator fm_partition::nodes_of_sideB_begin | ( | ) | const |
Iterate through all nodes which belong to side B
, It is only valid if enabled with fm_partition::store_nodesAB before.
B
nodes_of_one_side_iterator fm_partition::nodes_of_sideB_end | ( | ) | const |
End-Iterator for iteration through all nodes which belong to side B
, It is only valid if enabled with fm_partition::store_nodesAB before.
B
virtual void fm_partition::reset | ( | ) | [virtual] |
Resets fm_partition, i.e. prepares the algorithm to be applied to another graph.
Implements algorithm.
const side_type fm_partition::A [static] |
const side_type fm_partition::B [static] |
const fix_type fm_partition::FIXA [static] |
const fix_type fm_partition::FIXB [static] |
const fix_type fm_partition::UNFIXED [static] |
University of Passau - FMI - Theoretical Computer Science