Graph Funktionen
graph.h File Reference
#include <array>
#include <string>
#include <vector>
Include dependency graph for graph.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void read_edges_from_file (const std::string &file_name, std::vector< std::array< int, 2 >> &v)
 
std::vector< std::vector< int > > get_node2nodes (std::vector< std::array< int, 2 >> const &edges)
 

Function Documentation

◆ get_node2nodes()

std::vector<std::vector<int> > get_node2nodes ( std::vector< std::array< int, 2 >> const &  edges)

Determines the neighboring vertices for each node from the edge definition edges . The node itself is not contained in the neighboring vertices.

Parameters
[in]edgesvector[ne][2] with edge vertices
Returns
vector[nn][*] with all neighboring vertices for each node
Warning
We assume that the nodes are continuously numbered from 0 to nn-1. Otherwise we have to use map< int, vector<int> > as data structure.

◆ read_edges_from_file()

void read_edges_from_file ( const std::string &  file_name,
std::vector< std::array< int, 2 >> &  v 
)

This function opens the ASCII-file named file_name and reads the int data into the C++ vector v. If the file file_name does not exist then the code stops with an appropriate message.

Parameters
[in]file_namename of the ASCII-file
[out]vC++ vector with edge vertices