CXXGraph  0.4.0
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
Public Member Functions | List of all members
CXXGRAPH::PARTITIONING::Partition< T > Class Template Reference
Inheritance diagram for CXXGRAPH::PARTITIONING::Partition< T >:
Inheritance graph
[legend]
Collaboration diagram for CXXGRAPH::PARTITIONING::Partition< T >:
Collaboration graph
[legend]

Public Member Functions

 Partition (unsigned int partitionId)
 
 Partition (const T_EdgeSet< T > &edgeSet)
 
 Partition (unsigned int partitionId, const T_EdgeSet< T > &edgeSet)
 
unsigned int getPartitionId () const
 Get the Partition ID. More...
 
void setPartitionId (unsigned int partitionId)
 Set the Partition ID. More...
 
- Public Member Functions inherited from CXXGRAPH::Graph< T >
 Graph (const T_EdgeSet< T > &edgeSet)
 
virtual const T_EdgeSet< T > & getEdgeSet () const
 Function that return the Edge set of the Graph Note: No Thread Safe. More...
 
virtual void setEdgeSet (T_EdgeSet< T > &edgeSet)
 Function set the Edge Set of the Graph Note: No Thread Safe. More...
 
virtual void addEdge (const Edge< T > *edge)
 Function add an Edge to the Graph Edge Set Note: No Thread Safe. More...
 
virtual void removeEdge (unsigned long long edgeId)
 Function remove an Edge from the Graph Edge Set Note: No Thread Safe. More...
 
virtual const std::set< const Node< T > * > getNodeSet () const
 Function that return the Node Set of the Graph Note: No Thread Safe. More...
 
virtual const std::optional< const Edge< T > * > getEdge (unsigned long long edgeId) const
 Function that return an Edge with specific ID if Exist in the Graph Note: No Thread Safe. More...
 
virtual const AdjacencyMatrix< T > getAdjMatrix () const
 This function generate a list of adjacency matrix with every element of the matrix contain the node where is directed the link and the Edge corrispondent to the link Note: No Thread Safe.
 
virtual unsigned long long setFind (std::unordered_map< unsigned long long, Subset > *, const unsigned long long elem) const
 This function finds the subset of given a nodeId Subset is stored in a map where keys are the hash-id of the node & values is the subset. More...
 
virtual void setUnion (std::unordered_map< unsigned long long, Subset > *, const unsigned long long set1, const unsigned long long elem2) const
 This function modifies the original subset array such that it the union of two sets a and b. More...
 
virtual std::vector< Node< T > > eulerianPath () const
 This function finds the eulerian path of a directed graph using hierholzers algorithm. More...
 
virtual const DijkstraResult dijkstra (const Node< T > &source, const Node< T > &target) const
 Function runs the dijkstra algorithm for some source node and target node in the graph and returns the shortest distance of target from the source. Note: No Thread Safe. More...
 
virtual const BellmanFordResult bellmanford (const Node< T > &source, const Node< T > &target) const
 Function runs the bellman-ford algorithm for some source node and target node in the graph and returns the shortest distance of target from the source. It can also detect if a negative cycle exists in the graph. Note: No Thread Safe. More...
 
virtual const FWResult floydWarshall () const
 Function runs the floyd-warshall algorithm and returns the shortest distance of all pair of nodes. It can also detect if a negative cycle exists in the graph. Note: No Thread Safe. More...
 
virtual const MstResult prim () const
 Function runs the prim algorithm and returns the minimum spanning tree if the graph is undirected. Note: No Thread Safe. More...
 
virtual const MstResult boruvka () const
 Function runs the boruvka algorithm and returns the minimum spanning tree & cost if the graph is undirected. Note: No Thread Safe. More...
 
virtual const MstResult kruskal () const
 Function runs the kruskal algorithm and returns the minimum spanning tree if the graph is undirected. Note: No Thread Safe. More...
 
virtual const std::vector< Node< T > > breadth_first_search (const Node< T > &start) const
 Function performs the breadth first search algorithm over the graph Note: No Thread Safe. More...
 
virtual const std::vector< Node< T > > depth_first_search (const Node< T > &start) const
 Function performs the depth first search algorithm over the graph Note: No Thread Safe. More...
 
virtual bool isCyclicDirectedGraphDFS () const
 This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: No Thread Safe. More...
 
virtual bool isCyclicDirectedGraphBFS () const
 This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: No Thread Safe. More...
 
virtual bool containsCycle (const T_EdgeSet< T > *) const
 This function checks if the given set of edges forms a cycle or not using union-find method. More...
 
virtual bool containsCycle (const T_EdgeSet< T > *edgeSet, std::unordered_map< unsigned long long, Subset > *) const
 This function checks if the given Subset forms a cycle or not using union-find method. More...
 
virtual bool isDirectedGraph () const
 This function checks if a graph is directed Note: No Thread Safe. More...
 
virtual bool isUndirectedGraph () const
 This function checks if a graph is undirected Note: No Thread Safe. More...
 
virtual bool isConnectedGraph () const
 This function checks if the graph is connected or not Applicable for Undirected Graph, for Directed Graph use the isStronglyConnectedGraph() function. More...
 
virtual bool isStronglyConnectedGraph () const
 This function checks if the graph is strongly connected or not Applicable for Directed Graph, for Undirected Graph use the isConnectedGraph() function. More...
 
virtual std::vector< std::vector< Node< T > > > kosaraju () const
 This function performs performs the kosaraju algorthm on the graph to find the strongly connected components. More...
 
virtual const std::vector< Node< T > > graph_slicing (const Node< T > &start) const
 This function performs Graph Slicing based on connectivity. More...
 
virtual const DialResult dial (const Node< T > &source, int maxWeight) const
 This function write the graph in an output file Note: No Thread Safe. More...
 
virtual double fordFulkersonMaxFlow (const Node< T > &source, const Node< T > &target) const
 Function runs the Ford-Fulkerson algorithm for some source node and target node in the graph and returns the maximum flow of the graph. More...
 
virtual int writeToFile (InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const
 This function write the graph in an output file Note: No Thread Safe. More...
 
virtual int readFromFile (InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)
 This function read the graph from an input file Note: No Thread Safe. More...
 
virtual PartitionMap< T > partitionGraph (PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions, double param1=0.0, double param2=0.0, double param3=0.0, unsigned int numberOfthreads=std::thread::hardware_concurrency()) const
 This function partition a graph in a set of partitions Note: No Thread Safe. More...
 

Member Function Documentation

◆ getPartitionId()

template<typename T >
unsigned int CXXGRAPH::PARTITIONING::Partition< T >::getPartitionId

Get the Partition ID.

Returns
The ID of the partition

◆ setPartitionId()

template<typename T >
void CXXGRAPH::PARTITIONING::Partition< T >::setPartitionId ( unsigned int  partitionId)

Set the Partition ID.

Parameters
partitionIdthe ID to set

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