Esempio n. 1
0
int igraph_clusters(const igraph_t *graph, igraph_vector_t *membership, 
		    igraph_vector_t *csize, igraph_integer_t *no,
		    igraph_connectedness_t mode) {
  if (mode==IGRAPH_WEAK || !igraph_is_directed(graph)) {
    return igraph_clusters_weak(graph, membership, csize, no);
  } else if (mode==IGRAPH_STRONG) {
    return igraph_clusters_strong(graph, membership, csize, no);
  } else {
    IGRAPH_ERROR("Cannot calculate clusters", IGRAPH_EINVAL);
  }
  
  return 1;
}
Esempio n. 2
0
int igraph_is_connected(const igraph_t *graph, igraph_bool_t *res,
                        igraph_connectedness_t mode) {
    if (mode==IGRAPH_WEAK || !igraph_is_directed(graph)) {
        return igraph_is_connected_weak(graph, res);
    } else if (mode==IGRAPH_STRONG) {
        int retval;
        igraph_integer_t no;
        retval = igraph_clusters_strong(graph, 0, 0, &no);
        *res = (no==1);
        return retval;
    } else {
        IGRAPH_ERROR("mode argument", IGRAPH_EINVAL);
    }
    return 0;
}