All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
NetworKit::ConnectedComponents Class Reference

Determines the connected components of an undirected graph. More...

#include <ConnectedComponents.h>

Public Member Functions

 ConnectedComponents (const Graph &G)
 Create ConnectedComponents class for Graph G. More...
 
void run ()
 This method determines the connected components for the graph given in the constructor. More...
 
count numberOfComponents ()
 Get the number of connected components. More...
 
count componentOfNode (node u)
 Get the the component in which node u is situated. More...
 
Partition getPartition ()
 Get a Partition that represents the components. More...
 
std::map< index, countgetComponentSizes ()
 Return the map from component to size. More...
 
std::vector< std::vector< node > > getComponents ()
 
- Public Member Functions inherited from NetworKit::Algorithm
 Algorithm ()
 Constructor to the algorithm base class. More...
 
virtual ~Algorithm ()=default
 Virtual default destructor. More...
 
bool hasFinished () const
 Indicates whether an algorithm has completed computation or not. More...
 
void assureFinished () const
 Assure that the algorithm has been run, throws a std::runtime_error otherwise. More...
 
virtual std::string toString () const
 Returns a string with the algorithm's name and its parameters, if there are any. More...
 
virtual bool isParallel () const
 

Additional Inherited Members

- Protected Attributes inherited from NetworKit::Algorithm
bool hasRun
 A boolean variable indicating whether an algorithm has finished its computation or not. More...
 

Detailed Description

Determines the connected components of an undirected graph.

Constructor & Destructor Documentation

NetworKit::ConnectedComponents::ConnectedComponents ( const Graph G)

Create ConnectedComponents class for Graph G.

Parameters
GThe graph.

Member Function Documentation

count NetworKit::ConnectedComponents::componentOfNode ( node  u)
inline

Get the the component in which node u is situated.

Parameters
[in]uThe node whose component is asked for.
std::vector< std::vector< node > > NetworKit::ConnectedComponents::getComponents ( )
Returns
Vector of components, each stored as (unordered) set of nodes.
std::map< index, count > NetworKit::ConnectedComponents::getComponentSizes ( )

Return the map from component to size.

Partition NetworKit::ConnectedComponents::getPartition ( )

Get a Partition that represents the components.

Returns
A partition representing the found components.
count NetworKit::ConnectedComponents::numberOfComponents ( )
inline

Get the number of connected components.

Returns
The number of connected components.
void NetworKit::ConnectedComponents::run ( )
virtual

This method determines the connected components for the graph given in the constructor.

Implements NetworKit::Algorithm.


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