Graphviz 13.0.0~dev.20250210.0415
|
connected components filter for graphs More...
#include <assert.h>
#include <cgraph/cgraph.h>
#include <cgraph/ingraphs.h>
#include <common/render.h>
#include <common/utils.h>
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/exit.h>
#include <util/gv_ctype.h>
#include <util/list.h>
#include <util/prisize_t.h>
#include <util/strview.h>
#include <util/unreachable.h>
Go to the source code of this file.
Data Structures | |
struct | graphinfo_t |
struct | nodeinfo_t |
Macros | |
#define | GD_cc_subg(g) (((graphinfo_t *)(g->base.data))->cc_subg) |
#define | Node_mark(n) (((nodeinfo_t *)(n->base.data))->mark) |
#define | ND_ptr(n) (((nodeinfo_t *)(n->base.data))->ptr) |
#define | ND_dn(n) ((Agnode_t *)ND_ptr(n)) |
#define | Node_clust(n) ((Agraph_t *)ND_ptr(n)) |
#define | PFX1 "%s_cc" |
#define | PFX2 "%s_cc_%" PRISIZE_T |
Enumerations | |
enum | { INTERNAL , EXTERNAL , SILENT , EXTRACT } |
enum | { BY_INDEX = 1 , BY_SIZE = 2 } |
Functions | |
static void | usage (int v) |
static void | split (void) |
static void | init (int argc, char *argv[]) |
static void | push (Agnode_t *np) |
static Agnode_t * | pop (void) |
static int | dfs (Agraph_t *g, Agnode_t *n, Agraph_t *out) |
static char * | getName (void) |
static void | gwrite (Agraph_t *g) |
static Agraph_t * | projectG (Agraph_t *subg, Agraph_t *g, int inCluster) |
static void | subgInduce (Agraph_t *root, Agraph_t *g, int inCluster) |
static void | subGInduce (Agraph_t *g, Agraph_t *out) |
static void | deriveClusters (Agraph_t *dg, Agraph_t *g) |
static Agraph_t * | deriveGraph (Agraph_t *g) |
static void | unionNodes (Agraph_t *dg, Agraph_t *g) |
add all nodes in cluster nodes of dg to g | |
static int | cmp (const void *x, const void *y) |
static void | printSorted (Agraph_t *root, size_t c_cnt) |
static int | processClusters (Agraph_t *g, char *graphName) |
return 0 if graph is connected | |
static void | bindGraphinfo (Agraph_t *g) |
static int | process (Agraph_t *g, char *graphName) |
return 0 if graph is connected | |
static char * | chkGraphName (Agraph_t *g) |
int | main (int argc, char *argv[]) |
Variables | |
static char ** | Inputs |
static bool | verbose = false |
static enum { ... } | printMode = INTERNAL |
static bool | useClusters = false |
static bool | doEdges = true |
induce edges | |
static bool | doAll = true |
induce subgraphs | |
static char * | suffix = 0 |
static char * | outfile = 0 |
static strview_t | rootpath |
static int | sufcnt = 0 |
static bool | sorted = false |
static int | sortIndex = 0 |
static int | sortFinal |
static int | x_index = -1 |
static int | x_final = -1 |
static enum { ... } | x_mode |
static char * | x_node |
static char * | useString |
static node_stack_t | Stk |
#define GD_cc_subg | ( | g | ) | (((graphinfo_t *)(g->base.data))->cc_subg) |
#define ND_ptr | ( | n | ) | (((nodeinfo_t *)(n->base.data))->ptr) |
#define Node_mark | ( | n | ) | (((nodeinfo_t *)(n->base.data))->mark) |
anonymous enum |
|
static |
Definition at line 599 of file ccomps.c.
References agfstsubg(), aginit(), agnxtsubg(), AGRAPH, and bindGraphinfo().
Referenced by bindGraphinfo(), and process().
|
static |
Definition at line 719 of file ccomps.c.
References agnameof(), agxbprint(), and agxbuse().
Referenced by main().
|
static |
Definition at line 404 of file ccomps.c.
References agnnodes().
Referenced by printSorted().
Definition at line 336 of file ccomps.c.
References agbindrec(), agfstnode(), agfstsubg(), agnameof(), agnode(), agnxtnode(), agnxtsubg(), deriveClusters(), is_a_cluster(), ND_dn, and ND_ptr.
Referenced by deriveClusters(), and deriveGraph().
Definition at line 361 of file ccomps.c.
References agbindrec(), agedge(), agfstnode(), agfstout(), aghead, agnameof(), agnode(), agnxtnode(), agnxtout(), agopen(), Agstrictundirected, deriveClusters(), ND_dn, ND_ptr, and NULL.
Referenced by cccomps(), and processClusters().
Definition at line 228 of file ccomps.c.
References agfstedge(), aghead, agnxtedge(), agsubnode(), agtail, cnt(), Node_mark, out(), pop(), and push().
Referenced by cccomps(), ccomps(), isConnected(), pccomps(), process(), and processClusters().
|
static |
Definition at line 247 of file ccomps.c.
References agxbdisown(), agxbprint(), agxbput(), strview_t::data, outfile, rootpath, strview_t::size, sufcnt, and suffix.
Referenced by gwrite(), and gwrite().
|
static |
Definition at line 263 of file ccomps.c.
References agwrite(), free(), getName(), graphviz_exit(), and outfile.
Referenced by printSorted(), process(), and processClusters().
|
static |
Definition at line 110 of file ccomps.c.
References BY_INDEX, BY_SIZE, doAll, doEdges, EXTERNAL, EXTRACT, gv_isdigit(), Inputs, INTERNAL, outfile, printMode, SILENT, sorted, sortFinal, sortIndex, split(), UNREACHABLE, usage, useClusters, verbose, x_final, x_index, x_mode, and x_node.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 730 of file ccomps.c.
References agclose(), chkGraphName(), graphviz_exit(), init(), Inputs, newIngraph(), nextGraph(), process(), and Stk.
|
static |
Definition at line 221 of file ccomps.c.
Referenced by closesubg(), closesubg(), construct_graph(), dfs(), dfs(), dfs(), freestack(), freestack(), genTree(), and search_component().
|
static |
Definition at line 428 of file ccomps.c.
References agfstsubg(), agnameof(), agnnodes(), agnxtsubg(), BY_INDEX, BY_SIZE, cmp(), doAll, free(), GD_cc_subg, gv_calloc(), gwrite(), sortFinal, sortIndex, subGInduce(), and x_mode.
Referenced by process(), and processClusters().
|
static |
Definition at line 607 of file ccomps.c.
References agdelete(), agfindnode, agfstnode(), aginit(), agnameof(), agnedges(), agnnodes(), AGNODE, agnxtnode(), AGRAPH, agsubg(), agxbfree(), agxbprint(), agxbuse(), bindGraphinfo(), BY_INDEX, BY_SIZE, dfs(), doAll, doEdges, EXTERNAL, EXTRACT, GD_cc_subg, graphName, graphviz_node_induce(), gwrite(), INTERNAL, Node_mark, out(), PFX1, PFX2, printMode, printSorted(), PRISIZE_T, processClusters(), sorted, subGInduce(), useClusters, verbose, x_final, x_index, x_mode, and x_node.
Referenced by main().
|
static |
Definition at line 489 of file ccomps.c.
References agclose(), agdelete(), agfindnode, agfstnode(), aginit(), agnameof(), agnedges(), agnnodes(), agnxtnode(), AGRAPH, agsubg(), agxbfree(), agxbprint(), agxbuse(), BY_INDEX, BY_SIZE, deriveGraph(), dfs(), doAll, doEdges, EXTERNAL, EXTRACT, GD_cc_subg, graphName, graphviz_node_induce(), gwrite(), INTERNAL, ND_dn, Node_mark, out(), PFX1, PFX2, printMode, printSorted(), PRISIZE_T, sorted, subGInduce(), unionNodes(), verbose, x_final, x_index, x_mode, and x_node.
Referenced by process().
Definition at line 287 of file ccomps.c.
References agcopyattr(), agfindnode, agfstnode(), agnameof(), agnxtnode(), agsubg(), agsubnode(), doEdges, and graphviz_node_induce().
Referenced by subgInduce().
|
static |
|
static |
Definition at line 99 of file ccomps.c.
References strview_t::data, outfile, rootpath, strview(), and suffix.
Referenced by init(), init(), and Block::splitBetween().
Definition at line 327 of file ccomps.c.
References out(), and subgInduce().
Referenced by cccomps(), printSorted(), process(), and processClusters().
Definition at line 314 of file ccomps.c.
References agfstsubg(), agnxtsubg(), GD_cc_subg, is_a_cluster(), projectG(), subgInduce(), and useClusters.
Referenced by subGInduce(), and subgInduce().
Definition at line 392 of file ccomps.c.
References agfstnode(), AGNODE, agnxtnode(), agsubnode(), AGTYPE, ND_dn, ND_ptr, and Node_clust.
Referenced by cccomps(), and processClusters().
|
static |
Definition at line 94 of file ccomps.c.
References graphviz_exit(), and useString.
|
static |
Definition at line 67 of file ccomps.c.
Referenced by init(), newPos(), printSorted(), process(), processClusters(), and vAdjust().
|
static |
Definition at line 66 of file ccomps.c.
Referenced by init(), neato_layout(), process(), processClusters(), and projectG().
|
static |
enum { ... } printMode |
Referenced by init(), process(), and processClusters().
|
static |
|
static |
Definition at line 72 of file ccomps.c.
Referenced by init(), process(), and processClusters().
|
static |
Definition at line 74 of file ccomps.c.
Referenced by init(), and printSorted().
|
static |
Definition at line 73 of file ccomps.c.
Referenced by init(), and printSorted().
|
static |
|
static |
|
static |
Definition at line 65 of file ccomps.c.
Referenced by Import_coord_clusters_from_dot(), init(), process(), and subgInduce().
|
static |
Definition at line 80 of file ccomps.c.
Referenced by usage().
|
static |
Definition at line 58 of file ccomps.c.
Referenced by init(), process(), and processClusters().
|
static |
Definition at line 76 of file ccomps.c.
Referenced by init(), process(), and processClusters().
|
static |
Definition at line 75 of file ccomps.c.
Referenced by init(), process(), and processClusters().
enum { ... } x_mode |
Referenced by init(), printSorted(), process(), and processClusters().
|
static |
Definition at line 78 of file ccomps.c.
Referenced by init(), process(), and processClusters().