45 #ifndef __H__UG__LIB_DISC__AMG_SOLVER__GRAPH_H__
46 #define __H__UG__LIB_DISC__AMG_SOLVER__GRAPH_H__
75 for(
size_t i=0; i<
m_data.size(); ++i)
86 for(
size_t i=0; i<
m_data.size(); ++i)
101 return m_data[node].size() ;
123 if(it ==
m_data[from].end())
124 m_data[from].push_back(to);
126 m_data[from].insert(it, to);
132 return m_data[row].begin();
144 return m_data[row].begin();
157 G.set_as_transpose_of(*
this);
165 for(
size_t i=0; i<other.size(); i++) rowSize[i] = 0;
167 for(
size_t i=0; i<other.size(); i++)
173 m_data.resize(other.size());
174 for(
size_t i=0; i<other.size(); i++)
177 m_data[i].reserve(rowSize[i]);
180 for(
size_t i=0; i < other.size(); i++)
185 m_data[from].push_back(to);
196 void pr(
size_t i)
const
198 std::cout <<
"graph row " << i <<
", length " <<
num_connections(i) <<
":" << std::endl;
200 std::cout << (*it) <<
" ";
201 std::cout << std::endl;
207 std::cout << *
this << std::endl;
212 std::cout <<
"============= graph ================ " << std::endl;
213 for(
size_t i=0; i<g.size(); ++i)
215 out <<
"[" << i <<
"]: ";
226 UG_ASSERT(i <
m_data.size(),
"graph contains " <<
m_data.size() <<
" nodes, but trying to access node " << i);
230 UG_ASSERT(a <
m_data.size() || b <
m_data.size(),
"graph contains " <<
m_data.size() <<
" nodes, but trying to access nodes " << a <<
" and " << b);
Definition: new_graph.h:69
row_iterator begin_row(size_t row)
Definition: new_graph.h:168
stdvector< stdvector< size_t > > m_data
Definition: old_graph.h:234
row_iterator end_row(size_t row)
Definition: new_graph.h:175
void set_as_transpose_of(const cgraph &other)
creates this graph as the transpose of other
Definition: old_graph.h:162
size_t size() const
Definition: old_graph.h:190
~cgraph()
Definition: old_graph.h:92
cgraph()
Definition: old_graph.h:69
void print() const
Definition: new_graph.h:316
size_t num_connections(size_t node) const
returns nr of nodes the node "node" is connected to.
Definition: old_graph.h:98
const size_t * const_row_iterator
Definition: new_graph.h:71
void size_check(size_t i) const
Definition: new_graph.h:306
stdvector< size_t >::const_iterator const_row_iterator
Definition: old_graph.h:64
size_t * row_iterator
Definition: new_graph.h:72
const_row_iterator end_row(size_t row) const
Definition: old_graph.h:147
void transpose()
tranpose this graph (by using create_as_tranpose of)
Definition: old_graph.h:154
void resize(size_t n)
Definition: new_graph.h:88
bool is_isolated(size_t i) const
Definition: old_graph.h:104
cgraph(size_t n)
Definition: old_graph.h:73
friend std::ostream & operator<<(std::ostream &out, const cgraph &g)
Definition: old_graph.h:210
stdvector< size_t >::iterator row_iterator
Definition: old_graph.h:65
bool has_connection(size_t from, size_t to) const
returns true if graph has connection from "from" to "to", otherwise false
Definition: old_graph.h:112
const_row_iterator begin_row(size_t row) const
Definition: old_graph.h:141
void size_check(size_t a, size_t b) const
Definition: old_graph.h:228
void pr(size_t i) const
print row i
Definition: old_graph.h:196
void set_connection(size_t from, size_t to)
set a connection from "from" to "to" if not already there
Definition: old_graph.h:119
Definition: stl_debug.h:45
#define FORCE_CREATION
Definition: algebra_misc.h:46
#define UG_ASSERT(expr, msg)
Definition: assert.h:70