Visual Computing Library
Loading...
Searching...
No Matches
vcl::BipartiteGraph< T1, T2 > Class Template Reference

Public Types

using LeftType = T1
 
using RightType = T2
 
using LeftNodeType = UndirectedNode< T1 >
 
using RightNodeType = UndirectedNode< T2 >
 
using LeftNodeIterator = NodeIterator< typename std::vector< UndirectedNode< T1 > >::const_iterator >
 
using RightNodeIterator = NodeIterator< typename std::vector< UndirectedNode< T2 > >::const_iterator >
 
using LeftNodeView = View< LeftNodeIterator >
 
using RightNodeView = View< RightNodeIterator >
 
using AdjacentLeftNodeIterator = detail::AdjacentLeftNodeIterator< BipartiteGraph< T1, T2 >, std::unordered_set< unsigned int >::const_iterator >
 
using AdjacentRightNodeIterator = detail::AdjacentRightNodeIterator< BipartiteGraph< T1, T2 >, std::unordered_set< unsigned int >::const_iterator >
 
using AdjacentLeftNodeView = View< AdjacentLeftNodeIterator >
 
using AdjacentRightNodeView = View< AdjacentRightNodeIterator >
 

Public Member Functions

 BipartiteGraph ()
 Default constructor. It creates an empty Bipartite Graph.
 
bool leftNodeExists (const T1 &lNode) const
 Checks if a node exists on the left side of the graph.
 
bool rightNodeExists (const T2 &rNode) const
 Checks if a node exists on the right side of the graph.
 
uint leftNodesNumber () const
 Returns the number of left nodes of the graph.
 
uint rightNodesNumber () const
 Returns the number of right nodes of the graph.
 
uint adjacentLeftNodeNumber (const T1 &lNode) const
 Returns the number of adjacent nodes to lNode.
 
uint adjacentRightNodeNumber (const T2 &rNode) const
 Returns the number of adjacent nodes to rNode.
 
bool addLeftNode (const T1 &info)
 Adds a new node on the left side of the graph.
 
bool addRightNode (const T2 &info)
 Adds a new node on the right side of the graph.
 
bool deleteLeftNode (const T1 &lNode)
 Removes lNode and all its arcs from the graph.
 
bool deleteRightNode (const T2 &rNode)
 Removes rNode and all its arcs from the graph.
 
bool addArc (const T1 &lNode, const T2 &rNode)
 Creates an arc between lNode and rNode.
 
bool deleteArc (const T1 &lNode, const T2 &rNode)
 Removes the arc between lNode and rNode.
 
bool clearAdjacenciesLeftNode (const T1 &lNode)
 Removes all the arcs connected to lNode (lNode won't have adjacent nodes)
 
bool clearAdjacenciesRightNode (const T2 &rNode)
 Removes all the arcs connected to rNode (lNode won't have adjacent nodes)
 
bool setLeftNode (const T1 &old, const T1 &newInfo)
 Sets the key of an lNode.
 
bool setRightNode (const T2 &old, const T2 &newInfo)
 Sets the key of a rNode.
 
AdjacentLeftNodeIterator adjacentLeftNodeBegin (const T1 &lNode) const
 
AdjacentLeftNodeIterator adjacentLeftNodeEnd (const T1 &lNode) const
 
AdjacentRightNodeIterator adjacentRightNodeBegin (const T2 &rNode) const
 
AdjacentRightNodeIterator adjacentRightNodeEnd (const T2 &rNode) const
 
LeftNodeIterator leftNodeBegin () const
 
LeftNodeIterator leftNodeEnd () const
 
RightNodeIterator rightNodeBegin () const
 
RightNodeIterator rightNodeEnd () const
 
LeftNodeView leftNodes () const
 
RightNodeView rightNodes () const
 
AdjacentLeftNodeView adjacentLeftNodes (const T1 &lNode) const
 
AdjacentRightNodeView adjacentRightNodes (const T2 &rNode) const
 

Protected Member Functions

int getIdLeftNode (const T1 &uNode) const
 
int getIdRightNode (const T2 &vNode) const
 

Protected Attributes

std::map< T1, unsigned intmMapL
 
std::map< T2, unsigned intmMapR
 
std::vector< UndirectedNode< T1 > > mNodesL
 
std::vector< UndirectedNode< T2 > > mNodesR
 
std::set< unsigned intmUnusedLNodes
 
std::set< unsigned intmUnusedRNodes
 

Member Function Documentation

◆ addArc()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::addArc ( const T1 lNode,
const T2 rNode 
)
inline

Creates an arc between lNode and rNode.

Parameters
lNode
rNode
Returns
true if the arc is successfully created (both nodes exists in the graph)

◆ addLeftNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::addLeftNode ( const T1 info)
inline

Adds a new node on the left side of the graph.

Parameters
[in]infothe value associated to the new node
Returns
true if the node is correctly added, false otherwise (if the node already exists)

◆ addRightNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::addRightNode ( const T2 info)
inline

Adds a new node on the right side of the graph.

Parameters
[in]infothe value associated to the new node
Returns
true if the node is correctly added, false otherwise (if the node already exists)

◆ adjacentLeftNodeNumber()

template<class T1 , class T2 >
uint vcl::BipartiteGraph< T1, T2 >::adjacentLeftNodeNumber ( const T1 lNode) const
inline

Returns the number of adjacent nodes to lNode.

Parameters
lNode
Returns
the number of adjacent nodes to lNode

◆ adjacentRightNodeNumber()

template<class T1 , class T2 >
uint vcl::BipartiteGraph< T1, T2 >::adjacentRightNodeNumber ( const T2 rNode) const
inline

Returns the number of adjacent nodes to rNode.

Parameters
rNode
Returns
the number of adjacent nodes to rNode

◆ clearAdjacenciesLeftNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::clearAdjacenciesLeftNode ( const T1 lNode)
inline

Removes all the arcs connected to lNode (lNode won't have adjacent nodes)

Parameters
lNode
Returns
true if all the arcs are successfully removes

◆ clearAdjacenciesRightNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::clearAdjacenciesRightNode ( const T2 rNode)
inline

Removes all the arcs connected to rNode (lNode won't have adjacent nodes)

Parameters
rNode
Returns
true if all the arcs are successfully removes

◆ deleteArc()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::deleteArc ( const T1 lNode,
const T2 rNode 
)
inline

Removes the arc between lNode and rNode.

Parameters
lNode
rNode
Returns
true if the arc is successfully deleted (both nodes and the arc exists in the graph)

◆ deleteLeftNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::deleteLeftNode ( const T1 lNode)
inline

Removes lNode and all its arcs from the graph.

Parameters
lNode
Returns
true if the node is successfully deleted

◆ deleteRightNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::deleteRightNode ( const T2 rNode)
inline

Removes rNode and all its arcs from the graph.

Parameters
rNode
Returns
true if the node is successfully deleted

◆ leftNodeExists()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::leftNodeExists ( const T1 lNode) const
inline

Checks if a node exists on the left side of the graph.

Parameters
lNode
Returns
true if the node exists

◆ leftNodesNumber()

template<class T1 , class T2 >
uint vcl::BipartiteGraph< T1, T2 >::leftNodesNumber ( ) const
inline

Returns the number of left nodes of the graph.

Returns
the number of nodes on the left side of the graph

◆ rightNodeExists()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::rightNodeExists ( const T2 rNode) const
inline

Checks if a node exists on the right side of the graph.

Parameters
rNode
Returns
true if the node exists

◆ rightNodesNumber()

template<class T1 , class T2 >
uint vcl::BipartiteGraph< T1, T2 >::rightNodesNumber ( ) const
inline

Returns the number of right nodes of the graph.

Returns
the number of nodes on the right side of the graph

◆ setLeftNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::setLeftNode ( const T1 old,
const T1 newInfo 
)
inline

Sets the key of an lNode.

Parameters
old
newInfo
Returns
true if the key of the node is successfully modified

◆ setRightNode()

template<class T1 , class T2 >
bool vcl::BipartiteGraph< T1, T2 >::setRightNode ( const T2 old,
const T2 newInfo 
)
inline

Sets the key of a rNode.

Parameters
old
newInfo
Returns
true if the key of the node is successfully modified

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