Flow123d  JS_before_hm-1621-g63a12c7
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DfsTopoSort Class Reference

#include <dfs_topo_sort.hh>

Collaboration diagram for DfsTopoSort:
Collaboration graph
[legend]

Public Member Functions

 DfsTopoSort (unsigned int nv)
 Constructor. More...
 
 ~DfsTopoSort ()
 Destructor. More...
 
void clear ()
 Clear content of adjacency lists. More...
 
void add_edge (unsigned int v, unsigned int w)
 
vector< unsigned int > topological_sort ()
 

Private Member Functions

void topological_sort_util (unsigned int v, bool visited[], stack< unsigned int > &stc)
 A function used by topological_sort. More...
 

Private Attributes

unsigned int nv_
 Number of vertices. More...
 
list< unsigned int > * adj_
 Pointer to an array containing adjacency lists. More...
 

Detailed Description

Class to represent a graph and allows to perform sorting.

DFS topological sorting is used.

Definition at line 32 of file dfs_topo_sort.hh.

Constructor & Destructor Documentation

DfsTopoSort::DfsTopoSort ( unsigned int  nv)
inline

Constructor.

Definition at line 45 of file dfs_topo_sort.hh.

DfsTopoSort::~DfsTopoSort ( )
inline

Destructor.

Definition at line 52 of file dfs_topo_sort.hh.

Member Function Documentation

void DfsTopoSort::add_edge ( unsigned int  v,
unsigned int  w 
)
inline

Add an edge to graph

Vertex 'w' is descendant of 'v'

Definition at line 69 of file dfs_topo_sort.hh.

void DfsTopoSort::clear ( )
inline

Clear content of adjacency lists.

Definition at line 58 of file dfs_topo_sort.hh.

vector< unsigned int > DfsTopoSort::topological_sort ( )

Makes a DFS Topological Sort of the complete graph and returns result vector of sorting algorithm.

Definition at line 103 of file dfs_topo_sort.hh.

void DfsTopoSort::topological_sort_util ( unsigned int  v,
bool  visited[],
stack< unsigned int > &  stc 
)
private

A function used by topological_sort.

Definition at line 83 of file dfs_topo_sort.hh.

Member Data Documentation

list<unsigned int>* DfsTopoSort::adj_
private

Pointer to an array containing adjacency lists.

Definition at line 37 of file dfs_topo_sort.hh.

unsigned int DfsTopoSort::nv_
private

Number of vertices.

Definition at line 34 of file dfs_topo_sort.hh.


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