45 #ifndef __H__UG__LIB_DISC__AMG_SOLVER__graph_H__
46 #define __H__UG__LIB_DISC__AMG_SOLVER__graph_H__
92 cons.resize(n+1, NULL);
106 if(
cons[node+1] == NULL)
return 0;
113 if(
cons[i+1] == NULL)
return false;
141 while(j<=i &&
cons[j+1] == NULL)
152 UG_ASSERT(from ==
size()-1 ||
cons[from+2] == NULL,
"only from back to front! ( from is " << from
153 <<
", cons[from+2] = " <<
cons[from+2] <<
"\n");
155 if(
cons[from+1]==NULL)
162 cons[from+1][0] = to;
171 if(
cons[row+1] == NULL)
return NULL;
184 if(
cons[row+1] == NULL)
return NULL;
220 for(
size_t i=0; i<other.
size(); i++) rowSize[i] = 0;
222 for(
size_t i=0; i<other.
size(); i++)
232 for(
size_t i=0; i<other.
size(); i++)
240 for(
size_t i=0; i < other.
size(); i++)
245 cons[from][rowSize[from]++] = to;
246 cons[to][rowSize[to]++] = from;
256 for(
size_t i=0; i<other.
size(); i++) rowSize[i] = 0;
258 for(
size_t i=0; i<other.
size(); i++)
267 for(
size_t i=0; i<other.
size(); i++)
275 for(
size_t i=0; i < other.
size(); i++)
280 cons[from][rowSize[from]++] = to;
297 for(
size_t i=0; i<
consmem; i++)
299 if(
cons[i] == NULL)
continue;
308 UG_ASSERT(i <
size(),
"graph contains " <<
size() <<
" nodes, but trying to access node " << i);
313 "graph contains " <<
size() <<
" nodes, but trying to access nodes " << i <<
" and " << j);
318 cout <<
"============= graph ================ " << endl;
319 for(
size_t i=0; i <
size(); i++)
323 cout << (*it) <<
" ";
Definition: new_graph.h:69
row_iterator begin_row(size_t row)
Definition: new_graph.h:168
stdvector< size_t * > cons
Definition: new_graph.h:330
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: new_graph.h:253
size_t size() const
Definition: new_graph.h:287
size_t iMaxTotalNrOfConnections
Definition: new_graph.h:333
~cgraph()
Definition: new_graph.h:98
cgraph()
Definition: new_graph.h:76
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: new_graph.h:103
stdvector< size_t > consmem
Definition: new_graph.h:331
const size_t * const_row_iterator
Definition: new_graph.h:71
void increase_maxtotalnrofconnections()
Definition: new_graph.h:290
void size_check(size_t i) const
Definition: new_graph.h:306
size_t * row_iterator
Definition: new_graph.h:72
const_row_iterator end_row(size_t row) const
Definition: new_graph.h:188
void transpose()
tranpose this graph (by using create_as_tranpose of)
Definition: new_graph.h:195
void symmetricize()
Definition: new_graph.h:206
void resize(size_t n)
Definition: new_graph.h:88
bool is_isolated(size_t i) const
Definition: new_graph.h:110
cgraph(size_t n)
Definition: new_graph.h:83
void size_check(size_t i, size_t j) const
Definition: new_graph.h:310
const_row_iterator begin_row(size_t row) const
Definition: new_graph.h:181
void init(size_t i)
returns true if graph has connection from "from" to "to", otherwise false
Definition: new_graph.h:125
size_t iTotalNrOfConnections
Definition: new_graph.h:332
void create_as_symmetricized(const cgraph &other)
Definition: new_graph.h:217
void set_connection(size_t from, size_t to)
set a connection from "from" to "to" if not already there
Definition: new_graph.h:148
#define FORCE_CREATION
Definition: algebra_misc.h:46
#define UG_ASSERT(expr, msg)
Definition: assert.h:70