![]() |
CXXGraph
0.2.0
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
|
Class that implement the Thread Safe Graph. More...
#include <Graph_TS.hpp>
Public Member Functions | |
Graph_TS (const std::list< const Edge< T > * > &edgeSet) | |
Graph_TS (const Graph< T > &graph) | |
const std::list< const Edge< T > * > & | getEdgeSet () const override |
Function that return the Edge set of the Graph Note: Thread Safe. More... | |
void | setEdgeSet (std::list< const Edge< T > * > &edgeSet) override |
Function set the Edge Set of the Graph Note: Thread Safe. More... | |
void | addEdge (const Edge< T > *edge) override |
Function add an Edge to the Graph Edge Set Note: Thread Safe. More... | |
void | removeEdge (unsigned long edgeId) override |
Function remove an Edge from the Graph Edge Set Note: Thread Safe. More... | |
const std::list< const Node< T > * > | getNodeSet () const override |
Function that return the Node Set of the Graph Note: Thread Safe. More... | |
const std::optional< const Edge< T > * > | getEdge (unsigned long edgeId) const override |
Function that return an Edge with specific ID if Exist in the Graph Note: Thread Safe. More... | |
const AdjacencyMatrix< T > | getAdjMatrix () const override |
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: Thread Safe. | |
const DijkstraResult | dijkstra (const Node< T > &source, const Node< T > &target) const override |
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: Thread Safe. More... | |
const BellmanFordResult | bellmanford (const Node< T > &source, const Node< T > &target) const override |
Function runs the bellmanford algorithm for some source node and target node in the graph and returns the shortest distance of target from the source if there is no negative cycle in the graph. Note: Thread Safe. More... | |
const FWResult | floydWarshall () const override |
Function runs the floyd-Warshall algorithm for every node in the graph and returns the shortest distance of each node from another node if there is no negative cycle in the graph. Note: Thread Safe. More... | |
const std::vector< Node< T > > | breadth_first_search (const Node< T > &start) const override |
Function performs the breadth first search algorithm over the graph Note: Thread Safe. More... | |
const std::vector< Node< T > > | depth_first_search (const Node< T > &start) const override |
Function performs the depth first search algorithm over the graph Note: Thread Safe. More... | |
bool | isCyclicDirectedGraphDFS () const override |
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: Thread Safe. More... | |
bool | isCyclicDirectedGraphBFS () const override |
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: Thread Safe. More... | |
bool | isDirectedGraph () const override |
This function checks if a graph is directed Note: Thread Safe. More... | |
const DialResult | dial (const Node< T > &source, int maxWeight) const override |
This function write the graph in an output file Note: Thread Safe. More... | |
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 override |
This function write the graph in an output file Note: Thread Safe. More... | |
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) override |
This function read the graph from an input file Note: Thread Safe. More... | |
PartitionMap< T > | partitionGraph (PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const override |
This function partition a graph in a set of partitions Note: Thread Safe. More... | |
![]() | |
Graph (const std::list< const Edge< T > * > &edgeSet) | |
virtual const PrimResult | prim () const |
Function runs the prim algorithm and returns the minimum spanning tree if the graph is undirected. Note: No Thread Safe. More... | |
virtual bool | isUndirectedGraph () const |
This function checks if a graph is undirected Note: No Thread Safe. More... | |
virtual const std::vector< Node< T > > | graph_slicing (const Node< T > &start) const |
This function performs Graph Slicing based on connectivity. More... | |
![]() | |
void | getLock () const |
void | releaseLock () const |
Additional Inherited Members | |
![]() | |
std::mutex | mutex |
Class that implement the Thread Safe Graph.
|
overridevirtual |
Function add an Edge to the Graph Edge Set Note: Thread Safe.
edge | The Edge to insert |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function runs the bellmanford algorithm for some source node and target node in the graph and returns the shortest distance of target from the source if there is no negative cycle in the graph. Note: Thread Safe.
source | source vertex |
target | target vertex |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function performs the breadth first search algorithm over the graph Note: Thread Safe.
start | Node from where traversing starts |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function performs the depth first search algorithm over the graph Note: Thread Safe.
start | Node from where traversing starts |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
This function write the graph in an output file Note: Thread Safe.
format | The Output format of the file |
workingDir | The path to the directory in which will be placed the output file |
OFileName | The Output File Name ( ) |
compress | Indicates if the output will be compressed |
writeNodeFeat | Indicates if export also Node Features |
writeEdgeWeight | Indicates if export also Edge Weights |
Function runs the Dial algorithm (Optimized Dijkstra for small range weights) for some source node and target node in the graph and returns the shortest distance of target from the source. Note: Thread Safe
source | source vertex |
maxWeight | maximum weight of the edge |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
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: Thread Safe.
source | source vertex |
target | target vertex |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function runs the floyd-Warshall algorithm for every node in the graph and returns the shortest distance of each node from another node if there is no negative cycle in the graph. Note: Thread Safe.
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function that return an Edge with specific ID if Exist in the Graph Note: Thread Safe.
edgeId | The Edge Id to return |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function that return the Edge set of the Graph Note: Thread Safe.
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function that return the Node Set of the Graph Note: Thread Safe.
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: Thread Safe.
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: Thread Safe.
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
This function checks if a graph is directed Note: Thread Safe.
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
This function partition a graph in a set of partitions Note: Thread Safe.
algorithm | The partition algorithm |
numberOfPartition | The number of partitions |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
This function read the graph from an input file Note: Thread Safe.
format | The Input format of the file |
workingDir | The path to the directory in which is placed the Input file |
OFileName | The Input File Name ( ) |
compress | Indicates if the Input is compressed |
readNodeFeat | Indicates if import also Node Features |
readEdgeWeight | Indicates if import also Edge Weights |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function remove an Edge from the Graph Edge Set Note: Thread Safe.
edgeId | The Edge Id to remove |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
Function set the Edge Set of the Graph Note: Thread Safe.
edgeSet | The Edge Set |
Reimplemented from CXXGRAPH::Graph< T >.
|
overridevirtual |
This function write the graph in an output file Note: Thread Safe.
format | The Output format of the file |
workingDir | The path to the directory in which is placed the Output file |
OFileName | The Output File Name ( ) |
compress | Indicates if the Output will be compressed ( Pay Attention if compress flag is true, not compressed files will be deleted [ #48 ] ) |
writeNodeFeat | Indicates if export also Node Features |
writeEdgeWeight | Indicates if export also Edge Weights |
Reimplemented from CXXGRAPH::Graph< T >.