![]() |
CXXGraph
0.2.0
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
|
Class that implement the Graph. ( This class is not Thread Safe ) More...
#include <Graph.hpp>
Public Member Functions | |
Graph (const std::list< const Edge< T > * > &edgeSet) | |
virtual const std::list< const Edge< T > * > & | getEdgeSet () const |
Function that return the Edge set of the Graph Note: No Thread Safe. More... | |
virtual void | setEdgeSet (std::list< const Edge< 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 edgeId) |
Function remove an Edge from the Graph Edge Set Note: No Thread Safe. More... | |
virtual const std::list< 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 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 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 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 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 | 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 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 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) const |
This function partition a graph in a set of partitions Note: No Thread Safe. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Graph< T > &graph) |
std::ostream & | operator<< (std::ostream &os, const AdjacencyMatrix< T > &adj) |
Class that implement the Graph. ( This class is not Thread Safe )
|
virtual |
Function add an Edge to the Graph Edge Set Note: No Thread Safe.
edge | The Edge to insert |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
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.
source | source vertex |
target | target vertex |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function performs the breadth first search algorithm over the graph Note: No Thread Safe.
start | Node from where traversing starts |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function performs the depth first search algorithm over the graph Note: No Thread Safe.
start | Node from where traversing starts |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
This function write the graph in an output file Note: No 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: No Thread Safe
source | source vertex |
maxWeight | maximum weight of the edge |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
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.
source | source vertex |
target | target vertex |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
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.
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function that return an Edge with specific ID if Exist in the Graph Note: No Thread Safe.
edgeId | The Edge Id to return |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function that return the Edge set of the Graph Note: No Thread Safe.
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function that return the Node Set of the Graph Note: No Thread Safe.
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
This function performs Graph Slicing based on connectivity.
Mathematical definition of the problem:
Let G be the set of nodes in a graph and n be a given node in that set. Let C be the non-strict subset of G containing both n and all nodes reachable from n, and let C' be its complement. There's a third set M, which is the non-strict subset of C containing all nodes that are reachable from any node in C'. The problem consists of finding all nodes that belong to C but not to M.
Note: No Thread Safe
start | Node from where traversing starts |
|
virtual |
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: No Thread Safe.
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with directed Graph Note: No Thread Safe.
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
This function checks if a graph is directed Note: No Thread Safe.
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
This function checks if a graph is undirected Note: No Thread Safe.
|
virtual |
This function partition a graph in a set of partitions Note: No Thread Safe.
algorithm | The partition algorithm |
numberOfPartition | The number of partitions |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function runs the prim algorithm and returns the minimum spanning tree if the graph is undirected. Note: No Thread Safe.
|
virtual |
This function read the graph from an input file Note: No 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 |
writeNodeFeat | Indicates if import also Node Features |
writeEdgeWeight | Indicates if import also Edge Weights |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function remove an Edge from the Graph Edge Set Note: No Thread Safe.
edgeId | The Edge Id to remove |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
Function set the Edge Set of the Graph Note: No Thread Safe.
edgeSet | The Edge Set |
Reimplemented in CXXGRAPH::Graph_TS< T >.
|
virtual |
This function write the graph in an output file Note: No 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 in CXXGRAPH::Graph_TS< T >.