CXXGraph
0.0.6
CXXGraph is a small library, header only, that manages the Graph and it's algorithm in C++
|
Public Types | |
enum | E_OutputFormat { STANDARD , OUT_1 , OUT_2 } |
typedef enum CXXGRAPH::Graph::E_OutputFormat | OutputFormat |
Public Member Functions | |
Graph (const std::set< const Edge< T > * > &edgeSet) | |
const std::set< const Edge< T > * > & | getEdgeSet () const |
void | setEdgeSet (std::set< const Edge< T > * > &edgeSet) |
void | addEdge (const Edge< T > &edge) |
void | removeEdge (unsigned long edgeId) |
const std::set< 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... | |
const bool | isCyclicDirectedGraphDFS () const |
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph. More... | |
const bool | isCyclicDirectedGraphBFS () const |
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph. More... | |
const bool | isDirectedGraph () const |
This function checks if a graph is directed. More... | |
int | writeToFile (OutputFormat format=OutputFormat::STANDARD, std::string OFileName="graph.csv", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const |
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) |
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 |
const 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.
const 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.
const bool CXXGRAPH::Graph< T >::isDirectedGraph |
This function checks if a graph is directed.
int CXXGRAPH::Graph< T >::writeToFile | ( | OutputFormat | format = OutputFormat::STANDARD , |
std::string | OFileName = "graph.csv" , |
||
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 |
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 |