|
Graph 3
|
#include <graph.h>
Public Member Functions | |
| graph (const std::string &file_name) | |
| Reads edges for graph from file. More... | |
| graph (graph const &org)=default | |
| graph (graph &&org)=default | |
| graph & | operator= (graph const &rhs)=default |
| graph & | operator= (graph &&rhs)=default |
| ~graph ()=default | |
| std::vector< std::vector< unsigned int > > | get_node2nodes () const |
| size_t | Nedges () const |
| size_t | Nvertices () const |
| size_t | Max_vertex () const |
| bool | Append (unsigned int v1, unsigned int v2) |
| Appends one directed edge to the graph. The method add only edges that not already contained in the graph. More... | |
| bool | Delete (unsigned int v1, unsigned int v2) |
Removes one directed edge (v1, v2) from the graph. The method add only edges that not already contained in the graph. More... | |
| bool | Delete (Edge const &e) |
Removes edge e from the graph. More... | |
| void | Delete (std::vector< Edge > const &v) |
| Removes the given edges from the graph. The method add only edges that not already contained in the graph. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, graph const &rhs) |
| Prints edges and vertices of the graph. More... | |
Directed graph class. A better graph class that doesn't requires a consecutive numbering of the vertices.
|
explicit |
Reads edges for graph from file.
If the file file_name does not exist then the code stops with an appropriate message.
A consecutive numbering of the vertices is required.
| [in] | file_name | name of the ASCII-file |
|
default |
|
default |
|
default |
| bool graph::Append | ( | unsigned int | v1, |
| unsigned int | v2 | ||
| ) |
| bool graph::Delete | ( | Edge const & | e | ) |
| void graph::Delete | ( | std::vector< Edge > const & | v | ) |
Removes the given edges from the graph. The method add only edges that not already contained in the graph.
| [in] | v | vector[ne],[2] of edges |
v[k][1], v[k][2]) doesn't exist in the graph. | bool graph::Delete | ( | unsigned int | v1, |
| unsigned int | v2 | ||
| ) |
| vector< vector< unsigned int > > graph::get_node2nodes | ( | ) | const |
Determines the neighboring vertices for each node from the edge definition. The node itself is not contained in the neighboring vertices.
Definition at line 35 of file graph.cpp.


|
inline |
|
inline |
|
inline |
|
friend |
Prints edges and vertices of the graph.
| [in,out] | s | output stream |
| [in] | rhs | graph |