Graph 2
graph Class Reference

#include <graph.h>

Public Member Functions

 graph (const std::string &file_name)
 Reads edges for graph from file. More...
 
 graph (graph const &org)=default
 
graphoperator= (graph const &rhs)=default
 
std::vector< std::vector< unsigned int > > get_node2nodes () const
 
size_t Nedges () const
 
size_t Nvertices () const
 
size_t Max_vertex () const
 

Friends

std::ostream & operator<< (std::ostream &s, graph const &rhs)
 

Detailed Description

A better graph class that doesn't requires a consecutive numbering of the vertices.

Definition at line 12 of file graph.h.

Constructor & Destructor Documentation

◆ graph() [1/2]

graph::graph ( const std::string &  file_name)

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.

Parameters
[in]file_namename of the ASCII-file

◆ graph() [2/2]

graph::graph ( graph const &  org)
default

Member Function Documentation

◆ get_node2nodes()

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.

Returns
vector[nn][*] with all neighboring vertices for each node

Definition at line 42 of file graph.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Max_vertex()

size_t graph::Max_vertex ( ) const
inline
Returns
largest vertex index

Definition at line 54 of file graph.h.

Here is the caller graph for this function:

◆ Nedges()

size_t graph::Nedges ( ) const
inline
Returns
number of edges

Definition at line 38 of file graph.h.

Here is the caller graph for this function:

◆ Nvertices()

size_t graph::Nvertices ( ) const
inline
Returns
number of vertices

Definition at line 46 of file graph.h.

Here is the caller graph for this function:

◆ operator=()

graph& graph::operator= ( graph const &  rhs)
default

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
graph const &  rhs 
)
friend

The documentation for this class was generated from the following files: