35 static int find_edge(
const struct hecmw_graph *graph,
46 static int add_edge_one_way(
struct hecmw_graph *graph,
117 if (add_edge_one_way(graph, vert1, vert2) ==
HECMW_SUCCESS &&
128 idx_t idx_start, idx_end;
131 fprintf(fp,
"num_edge = %lld\n", (
long long)graph->
m_num_edge);
134 fprintf(fp,
"%d: ", i);
136 idx_start = edge_index[i];
137 idx_end = edge_index[i + 1];
138 for (j = idx_start; j < idx_end; j++) {
139 fprintf(fp,
" %lld", (
long long)edge_item[j]);
163 const int *parttab) {
183 for (i = 0; i < num_part; i++) {
190 start = ref_edge_index[i];
191 end = ref_edge_index[i + 1];
192 for (j = start; j < end; j++) {
193 jj = ref_edge_item[j];
194 j_part = parttab[jj];
195 if (i_part == j_part)
continue;
208 for (i = 0; i < num_part; i++) {
212 edge_index[i + 1] = edge_index[i] + n_edge;
217 for (i = 0; i < num_part; i++) {
218 start = edge_index[i];
220 for (j = 0; j < n_edge; j++) {
225 for (i = 0; i < num_part; i++) {
233 for (i = 0; i < num_part; i++) {
253 int find_edge(
const struct hecmw_graph *graph,
int vert1,
int vert2,
257 idx_t idx_start, idx_end;
260 idx_start = edge_index[vert1];
261 idx_end = edge_index[vert1 + 1];
262 for (i = idx_start; i < idx_end; i++) {
263 if (edge_item[i] == vert2) {
271 int add_edge_one_way(
struct hecmw_graph *graph,
int vert1,
int vert2) {
279 if (find_edge(graph, vert1, vert2, &idx)) {
int HECMW_set_error(int errorno, const char *fmt,...)
int HECMW_graph_degeneGraph(struct hecmw_graph *graph, const struct hecmw_graph *refgraph, int num_part, const int *parttab)
const idx_t * HECMW_graph_getEdgeItem(const struct hecmw_graph *graph)
idx_t HECMW_graph_getNumEdge(const struct hecmw_graph *graph)
const idx_t * HECMW_graph_getEdgeIndex(const struct hecmw_graph *graph)
int HECMW_graph_addEdge(struct hecmw_graph *graph, int vert1, int vert2)
int HECMW_graph_getNumVertex(const struct hecmw_graph *graph)
int HECMW_graph_init_with_arrays(struct hecmw_graph *graph, int num_vertex, idx_t *edge_index, idx_t *edge_item)
void HECMW_graph_print(const struct hecmw_graph *graph, FILE *fp)
void HECMW_graph_finalize(struct hecmw_graph *graph)
void HECMW_graph_setNumVertex(struct hecmw_graph *graph, int num_vertex)
int HECMW_graph_init(struct hecmw_graph *graph)
#define HECMW_malloc(size)
#define HECMW_assert(cond)
void HECMW_varray_idx_finalize(struct hecmw_varray_idx *varray)
idx_t * HECMW_varray_idx_get_v(struct hecmw_varray_idx *varray)
int HECMW_varray_idx_assign(struct hecmw_varray_idx *varray, size_t begin, size_t end, idx_t val)
int HECMW_varray_idx_insert(struct hecmw_varray_idx *varray, size_t index, idx_t val)
int HECMW_varray_idx_resize(struct hecmw_varray_idx *varray, size_t len)
int HECMW_varray_idx_init(struct hecmw_varray_idx *varray)
const idx_t * HECMW_varray_idx_get_cv(const struct hecmw_varray_idx *varray)
size_t HECMW_varray_int_nval(const struct hecmw_varray_int *varray)
size_t HECMW_varray_int_uniq(struct hecmw_varray_int *varray)
void HECMW_varray_int_sort(struct hecmw_varray_int *varray)
int HECMW_varray_int_get(const struct hecmw_varray_int *varray, size_t index)
int HECMW_varray_int_init(struct hecmw_varray_int *varray)
void HECMW_varray_int_finalize(struct hecmw_varray_int *varray)
int HECMW_varray_int_append(struct hecmw_varray_int *varray, int value)
struct hecmw_varray_idx * m_edge_index
struct hecmw_varray_idx * m_edge_item