summaryrefslogtreecommitdiff
path: root/lib/get_dual_clusters.c
diff options
context:
space:
mode:
authorJaron <jaron@kent-dobias.com>2017-06-22 22:40:47 -0400
committerJaron <jaron@kent-dobias.com>2017-06-22 22:40:47 -0400
commitd59fc339a40a47405bfef8c1313e324adca70479 (patch)
treeaddf46044c3a1507bd4069797c6218c457b67e5f /lib/get_dual_clusters.c
parentf4a50f1332ff323c42aa9664292910fd78933c15 (diff)
parent4764d5d407347d4dd5990411b243b3ec4bd75bff (diff)
downloadfuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.tar.gz
fuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.tar.bz2
fuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.zip
lots of changes for merge
Diffstat (limited to 'lib/get_dual_clusters.c')
-rw-r--r--lib/get_dual_clusters.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/get_dual_clusters.c b/lib/get_dual_clusters.c
new file mode 100644
index 0000000..eaf7562
--- /dev/null
+++ b/lib/get_dual_clusters.c
@@ -0,0 +1,30 @@
+
+#include "fracture.h"
+
+components_t *get_clusters(net_t *instance) {
+ components_t *c = graph_components_get(instance->graph, instance->fuses, true);
+ return c;
+}
+
+unsigned int *get_cluster_dist(net_t *instance) {
+ components_t *c = get_clusters(instance);
+ unsigned int *cluster_dist = (unsigned int *)calloc(
+ instance->graph->dnv, sizeof(unsigned int));
+
+ for (uint32_t i = 1; i <= c->n; i++) {
+ unsigned int num_in_cluster = 0;
+ for (unsigned int j = 0; j < instance->graph->dnv; j++) {
+ if (c->labels[j] == i)
+ num_in_cluster++;
+ }
+
+ if (num_in_cluster == 0)
+ break;
+
+ cluster_dist[num_in_cluster - 1]++;
+ }
+
+ graph_components_free(c);
+
+ return cluster_dist;
+}