/* * A cluster is collapsed in three steps. * 1) The nodes of the cluster are ranked locally. * 2) The cluster is collapsed into one node on the least rank. * 3) In class1(), any inter-cluster edges are converted using * the "virtual node + 2 edges" trick. */ static void collapse_cluster(graph_t * g, graph_t * subg) { if (GD_cluster_was_collapsed(subg)) return; GD_cluster_was_collapsed(subg) = TRUE; node_induce(g, subg); if (agfstnode(subg) == NULL) return; make_new_cluster(g, subg); if (CL_type == LOCAL) { dot_rank(subg, 0, NULL); cluster_leader(subg); } else dot_scan_ranks(subg); }
/* * A cluster is collapsed in three steps. * 1) The nodes of the cluster are ranked locally. * 2) The cluster is collapsed into one node on the least rank. * 3) In class1(), any inter-cluster edges are converted using * the "virtual node + 2 edges" trick. */ static void collapse_cluster(graph_t * g, graph_t * subg) { if (GD_parent(subg)) { return; } GD_parent(subg) = g; node_induce(g, subg); if (agfstnode(subg) == NULL) return; make_new_cluster(g, subg); if (CL_type == LOCAL) { dot1_rank(subg, 0); cluster_leader(subg); } else dot_scan_ranks(subg); }
/* * A cluster is collapsed in three steps. * 1) The nodes of the cluster are ranked locally. * 2) The cluster is collapsed into one node on the least rank. * 3) In class1(), any inter-cluster edges are converted using * the "virtual node + 2 edges" trick. */ static void collapse_cluster(graph_t * g, graph_t * subg) { if (GD_parent(subg)) { #ifndef WITH_CGRAPH agerr(AGWARN, "Cluster %s is multiply defined in %s and %s - this may cause problems.\n", subg->name, g->name, GD_parent(subg)->name); #endif return; } GD_parent(subg) = g; node_induce(g, subg); if (agfstnode(subg) == NULL) return; make_new_cluster(g, subg); if (CL_type == LOCAL) { dot1_rank(subg, 0); cluster_leader(subg); } else dot_scan_ranks(subg); }