Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
bcomps.c File Reference

biconnected components filter for graphs More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <getopt.h>
#include <stdlib.h>
#include <cgraph/cgraph.h>
#include <cgraph/ingraphs.h>
#include <cgraph/list.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/exit.h>
#include <util/gv_math.h>
#include <util/unreachable.h>
Include dependency graph for bcomps.c:

Go to the source code of this file.

Data Structures

struct  Agraphinfo_t
 
struct  Agedgeinfo_t
 
struct  Agnodeinfo_t
 
struct  bcstate
 

Macros

#define Low(n)   (((Agnodeinfo_t*)(n->base.data))->low)
 
#define Cut(n)   (((Agnodeinfo_t*)(n->base.data))->isCut)
 
#define N(n)   (((Agnodeinfo_t*)(n->base.data))->val)
 
#define NEXTBLK(g)   (((Agraphinfo_t*)(g->base.data))->next)
 

Functions

static char * blockName (agxbuf *xb, char *gname, int d)
 
static char * getName (int ng, int nb)
 
static void gwrite (Agraph_t *g, int ng, int nb)
 
static Agraph_tmkBlock (Agraph_t *g, bcstate *stp)
 
static void dfs (Agraph_t *g, Agnode_t *u, bcstate *stp, Agnode_t *parent)
 
static void addCutPts (Agraph_t *tree, Agraph_t *blk)
 
static int process (Agraph_t *g, int gcnt)
 
static void usage (int v)
 
static void split (char *name)
 
static void init (int argc, char *argv[])
 
int main (int argc, char *argv[])
 

Variables

char ** Files
 
int verbose
 
int silent
 
char * outfile = 0
 
char * path = 0
 
char * suffix = 0
 
int external
 
int doTree
 
static char * useString
 

Macro Definition Documentation

◆ Cut

#define Cut (   n)    (((Agnodeinfo_t*)(n->base.data))->isCut)

Definition at line 57 of file bcomps.c.

◆ Low

#define Low (   n)    (((Agnodeinfo_t*)(n->base.data))->low)

Definition at line 56 of file bcomps.c.

◆ N

#define N (   n)    (((Agnodeinfo_t*)(n->base.data))->val)

Definition at line 58 of file bcomps.c.

◆ NEXTBLK

#define NEXTBLK (   g)    (((Agraphinfo_t*)(g->base.data))->next)

Definition at line 59 of file bcomps.c.

Function Documentation

◆ addCutPts()

static void addCutPts ( Agraph_t tree,
Agraph_t blk 
)
static

Definition at line 190 of file bcomps.c.

References agedge(), agfstnode(), agnameof(), agnode(), agnxtnode(), Cut, and tree.

Referenced by process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ blockName()

static char * blockName ( agxbuf xb,
char *  gname,
int  d 
)
static

Definition at line 79 of file bcomps.c.

References agxbprint(), agxbuse(), and gname.

Referenced by mkBlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dfs()

static void dfs ( Agraph_t g,
Agnode_t u,
bcstate stp,
Agnode_t parent 
)
static

Definition at line 155 of file bcomps.c.

References agfstedge(), aghead, agnxtedge(), agsubnode(), agtail, bcstate::count, Cut, dfs(), imin(), Low, mkBlock(), N, parent, and bcstate::stk.

Referenced by dfs(), and process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getName()

static char * getName ( int  ng,
int  nb 
)
static

Definition at line 93 of file bcomps.c.

References agxbdisown(), agxbprint(), agxbput(), outfile, and suffix.

Here is the call graph for this function:

◆ gwrite()

static void gwrite ( Agraph_t g,
int  ng,
int  nb 
)
static

Definition at line 115 of file bcomps.c.

References agwrite(), free(), getName(), graphviz_exit(), outfile, and silent.

Referenced by process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

static void init ( int  argc,
char *  argv[] 
)
static

Definition at line 291 of file bcomps.c.

References doTree, external, Files, outfile, silent, split(), UNREACHABLE, usage, and verbose.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 338 of file bcomps.c.

References agclose(), Files, graphviz_exit(), init(), newIngraph(), nextGraph(), and process().

Here is the call graph for this function:

◆ mkBlock()

static Agraph_t * mkBlock ( Agraph_t g,
bcstate stp 
)
static

Definition at line 140 of file bcomps.c.

References agbindrec(), agnameof(), agsubg(), agxbfree(), bcstate::blks, blockName(), bcstate::nComp, and NEXTBLK.

Referenced by createOneBlock(), dfs(), and makeBlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process()

static int process ( Agraph_t g,
int  gcnt 
)
static

Definition at line 205 of file bcomps.c.

References addCutPts(), agclose(), AGEDGE, agfstnode(), aginit(), agnameof(), AGNODE, agnxtnode(), agopen(), AGRAPH, Agstrictundirected, bcstate::blks, bcstate::count, Cut, dfs(), doTree, external, graphviz_node_induce(), gwrite(), N, bcstate::nComp, NEXTBLK, bcstate::stk, tree, and verbose.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ split()

static void split ( char *  name)
static

Definition at line 277 of file bcomps.c.

References gv_strndup(), and suffix.

Here is the call graph for this function:

◆ usage()

static void usage ( int  v)
static

Definition at line 271 of file bcomps.c.

References graphviz_exit(), and useString.

Here is the call graph for this function:

Variable Documentation

◆ doTree

int doTree

Definition at line 68 of file bcomps.c.

Referenced by init(), and process().

◆ external

int external

Definition at line 67 of file bcomps.c.

Referenced by init(), and process().

◆ Files

char** Files

Definition at line 61 of file bcomps.c.

Referenced by init(), and main().

◆ outfile

char* outfile = 0

Definition at line 64 of file bcomps.c.

Referenced by getName(), gwrite(), and init().

◆ path

char* path = 0

Definition at line 65 of file bcomps.c.

◆ silent

int silent

Definition at line 63 of file bcomps.c.

Referenced by gwrite(), and init().

◆ suffix

char* suffix = 0

Definition at line 66 of file bcomps.c.

Referenced by getName(), gvplugin_library_load(), smyrnaPath(), and split().

◆ useString

char* useString
static
Initial value:
=
"Usage: bcomps [-stvx?] [-o<out template>] <files>\n\
-o - output file template\n\
-s - don't print components\n\
-t - emit block-cutpoint tree\n\
-v - verbose\n\
-x - external\n\
-? - print usage\n\
If no files are specified, stdin is used\n"

Definition at line 261 of file bcomps.c.

Referenced by usage().

◆ verbose

int verbose

Definition at line 62 of file bcomps.c.

Referenced by init(), process(), resolve(), SWIG_Ruby_GetModule(), and SWIG_RubyInitializeTrackings().