Tulip  5.2.1
Large graphs analysis and drawing
tlp::ConnectedTest Class Reference

#include <ConnectedTest.h>

+ Inheritance diagram for tlp::ConnectedTest:
+ Collaboration diagram for tlp::ConnectedTest:

Static Public Member Functions

static void computeConnectedComponents (const Graph *graph, std::vector< std::vector< node >> &components)
 
static void computeConnectedComponents (const Graph *graph, std::vector< std::set< node >> &components)
 
static bool isConnected (const Graph *const graph)
 
static void makeConnected (Graph *graph, std::vector< edge > &addedEdges)
 
static unsigned int numberOfConnectedComponents (const Graph *const graph)
 
- Static Public Member Functions inherited from tlp::Observable
static void disableEventNotification ()
 
static void enableEventNotification ()
 
static tlp::node getNode (const tlp::Observable *obs)
 
static ObservablegetObject (tlp::node n)
 
static const tlp::VectorGraph & getObservableGraph ()
 
static unsigned int getScheduled (tlp::node n)
 
static void holdObservers ()
 
static bool isAlive (tlp::node n)
 
static unsigned int observersHoldCounter ()
 
static void unholdObservers ()
 

Additional Inherited Members

- Public Member Functions inherited from tlp::Observable
void addListener (Observable *const listener) const
 
void addObserver (Observable *const observer) const
 
unsigned int countListeners () const
 
unsigned int countObservers () const
 
unsigned int getReceived () const
 
unsigned int getSent () const
 
void removeListener (Observable *const listener) const
 
void removeObserver (Observable *const observerver) const
 
- Protected Member Functions inherited from tlp::Observable
 Observable (const Observable &)
 
bool hasOnlookers () const
 
void observableDeleted ()
 
Observableoperator= (const Observable &)
 
void sendEvent (const Event &message)
 
virtual void treatEvents (const std::vector< Event > &events)
 

Detailed Description

Performs a test of connexity on the graph, and provides a function to make a graph connected. From Wikipedia: "A graph is said to be connected if every pair of vertices in the graph are connected." (i.e. there is a path between every pair of vertices).

Definition at line 38 of file ConnectedTest.h.

Member Function Documentation

◆ computeConnectedComponents() [1/2]

static void tlp::ConnectedTest::computeConnectedComponents ( const Graph graph,
std::vector< std::vector< node >> &  components 
)
static

Computes the sets of connected components and stores the result in the components vector.

Parameters
graphThe graph on which to compute connected components.
componentsThe components that were found. It is passed as a reference to avoid copying the data when returning.
Returns
void
Note
The components parameter can be returned with c++11 thanks to move constructors without performance loss, change this function once c++11 compilers are used.

◆ computeConnectedComponents() [2/2]

static void tlp::ConnectedTest::computeConnectedComponents ( const Graph graph,
std::vector< std::set< node >> &  components 
)
static

This function is defined for compatibility purpose only.

Warning
This function is deprecated, use the one above.

◆ isConnected()

static bool tlp::ConnectedTest::isConnected ( const Graph *const  graph)
static

Checks if a graph is connected (i.e. there is a path between every pair of vertices).

Parameters
graphThe graph to check.
Returns
bool True if the graph is connected, false otherwise.

◆ makeConnected()

static void tlp::ConnectedTest::makeConnected ( Graph graph,
std::vector< edge > &  addedEdges 
)
static

If the graph is not connected, adds edges to make it connected.

Parameters
graphThe graph to make connected.
addedEdgesThe edges that were added to make it connected.
Returns
void

◆ numberOfConnectedComponents()

static unsigned int tlp::ConnectedTest::numberOfConnectedComponents ( const Graph *const  graph)
static

Gets the number of connected components in the graph.

Parameters
graphThe graph in which to count the number of connected components.
Returns
unsigned int The number of connected componments.