MinLCA algorithms
Public Member Functions | Protected Types | Protected Attributes | Private Member Functions | Friends | List of all members
minlca::MinLCAGreedyBfs< Greedy, Graph > Class Template Reference

Class for greedy algorithms using a breadth-first search. More...

#include <greedy.hh>

Inheritance diagram for minlca::MinLCAGreedyBfs< Greedy, Graph >:
[legend]
Collaboration diagram for minlca::MinLCAGreedyBfs< Greedy, Graph >:
[legend]

Public Member Functions

 TEMPLATE_GRAPH_TYPEDEFS (Graph)
 
 MinLCAGreedyBfs (const Graph &g, int maxK=0)
 Constructor for the algorithm class. More...
 
virtual ~MinLCAGreedyBfs ()
 Destructor.
 
virtual void init ()
 
void setSourceNodes (const std::list< Node > &sources)
 Set source vertices. More...
 
void setSourceNode (const Node &v)
 Set source node. More...
 
virtual MinLCAStatus run ()
 

Protected Types

typedef Greedy< Graph > BaseGreedy
 The greedy algorithm.
 
typedef MinLCAGreedyBfs< Greedy, Graph > Visitor
 This class.
 

Protected Attributes

std::list< Node > _sources
 List of source nodes for BFS.
 
lemon::BfsVisit< Graph, Visitor > * _bfs
 Pointer to the visitor class.
 

Private Member Functions

void connectedComponentsSourceNodes ()
 Set sources to one vertex of each connected component. More...
 
void process (const Node &v)
 Process vertex. More...
 

Friends

class lemon::BfsVisit< Graph, Visitor >
 

Detailed Description

template<template< typename > class Greedy, typename Graph = lemon::SmartGraph>
class minlca::MinLCAGreedyBfs< Greedy, Graph >

Class for greedy algorithms using a breadth-first search.

Definition at line 52 of file greedy.hh.

Constructor & Destructor Documentation

template<template< typename > class Greedy, typename Graph = lemon::SmartGraph>
minlca::MinLCAGreedyBfs< Greedy, Graph >::MinLCAGreedyBfs ( const Graph &  g,
int  maxK = 0 
)
inline

Constructor for the algorithm class.

See also
MinLCA::MinLCA(const Graph &, int)

Definition at line 74 of file greedy.hh.

Member Function Documentation

template<template< typename > class Greedy, typename Graph = lemon::SmartGraph>
void minlca::MinLCAGreedyBfs< Greedy, Graph >::connectedComponentsSourceNodes ( )
inlineprivate

Set sources to one vertex of each connected component.

Helper method to set sources to one vertex of each connected component

Definition at line 141 of file greedy.hh.

template<template< typename > class Greedy, typename Graph = lemon::SmartGraph>
void minlca::MinLCAGreedyBfs< Greedy, Graph >::process ( const Node &  v)
inlineprivate

Process vertex.

Overrides lemon::BfsVisitor::process(const Node&). Makes use of MinLCAGreedy::paintVertex(const Node &).

See also
MinLCAGreedy::paintVertex(const Node &)
MinLCAGreedyNearest::paintVertex(const Node &)
MinLCAGreedyLeastCost::paintVertex(const Node &)

Definition at line 163 of file greedy.hh.

template<template< typename > class Greedy, typename Graph = lemon::SmartGraph>
void minlca::MinLCAGreedyBfs< Greedy, Graph >::setSourceNode ( const Node &  v)
inline

Set source node.

Set the source node.

See also
#setSourceNodes(std::list<Node> &)
Warning
Calling #init() resets the list!
Parameters
vSource vertex

Definition at line 114 of file greedy.hh.

template<template< typename > class Greedy, typename Graph = lemon::SmartGraph>
void minlca::MinLCAGreedyBfs< Greedy, Graph >::setSourceNodes ( const std::list< Node > &  sources)
inline

Set source vertices.

Set the source vertices for the BFS to a list of nodes. If sources are not explicitly set, by default they are set to a list of vertices representing the connected components.

Warning
Calling #init() resets the list!
Parameters
sourcesList of sources

Definition at line 101 of file greedy.hh.


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