CXXGraph
0.1.0
CXXGraph is a small library, header only, that manages the Graph and it's algorithm in C++
|
Public Types | |
enum | E_InputOutputFormat { STANDARD_CSV , OUT_1 , OUT_2 } |
Specify the Input/Output format of the Graph for Import/Export functions. More... | |
typedef enum CXXGRAPH::Graph::E_InputOutputFormat | InputOutputFormat |
Specify the Input/Output format of the Graph for Import/Export functions. | |
Public Member Functions | |
Graph (const std::list< const Edge< T > * > &edgeSet) | |
const std::list< const Edge< T > * > & | getEdgeSet () const |
void | setEdgeSet (std::list< const Edge< T > * > &edgeSet) |
void | addEdge (const Edge< T > *edge) |
void | removeEdge (unsigned long edgeId) |
const std::list< const Node< T > * > | getNodeSet () const |
const std::optional< const Edge< T > * > | getEdge (unsigned long edgeId) const |
const AdjacencyMatrix< T > | getAdjMatrix () const |
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. More... | |
const std::vector< Node< T > > | breadth_first_search (const Node< T > &start) const |
Function performs the breadth first search algorithm over the graph. More... | |
const std::vector< Node< T > > | depth_first_search (const Node< T > &start) const |
Function performs the depth first search algorithm over the graph. More... | |
bool | isCyclicDirectedGraphDFS () const |
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph. More... | |
bool | isCyclicDirectedGraphBFS () const |
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph. More... | |
bool | isDirectedGraph () const |
This function checks if a graph is directed. 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 |
This function write the graph in an output file. 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) |
This function write the graph in an output file. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Graph< T > &graph) |
std::ostream & | operator<< (std::ostream &os, const AdjacencyMatrix< T > &adj) |
enum CXXGRAPH::Graph::E_InputOutputFormat |
Specify the Input/Output format of the Graph for Import/Export functions.
Enumerator | |
---|---|
STANDARD_CSV | A standard csv format. |
const std::vector< Node< T > > CXXGRAPH::Graph< T >::breadth_first_search | ( | const Node< T > & | start | ) | const |
const std::vector< Node< T > > CXXGRAPH::Graph< T >::depth_first_search | ( | const Node< T > & | start | ) | const |
const DijkstraResult CXXGRAPH::Graph< T >::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.
source | source vertex |
target | target vertex |
bool CXXGRAPH::Graph< T >::isCyclicDirectedGraphBFS |
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph.
bool CXXGRAPH::Graph< T >::isCyclicDirectedGraphDFS |
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph.
bool CXXGRAPH::Graph< T >::isDirectedGraph |
This function checks if a graph is directed.
int CXXGRAPH::Graph< T >::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 write the graph in an output file.
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 |
writeNodeFeat | Indicates if import also Node Features |
writeEdgeWeight | Indicates if import also Edge Weights |
int CXXGRAPH::Graph< T >::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.
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 |