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

Matrix Market-DOT converter More...

#include "config.h"
#include <util/alloc.h>
#include <cgraph/cgraph.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "mmio.h"
#include <sparse/SparseMatrix.h>
#include <util/agxbuf.h>
#include <util/unreachable.h>
#include "matrix_market.h"
#include <getopt.h>
Include dependency graph for mm2gv.c:

Go to the source code of this file.

Data Structures

struct  Agnodeinfo_t
 
struct  parms_t
 

Macros

#define STANDALONE
 
#define ND_id(n)   (((Agnodeinfo_t*)(n->base.data))->id)
 

Functions

static double Hue2RGB (double v1, double v2, double H)
 
static char * hue2rgb (double hue, agxbuf *xb)
 
static Agraph_tmakeDotGraph (SparseMatrix A, char *name, int dim, double *x, int with_color, int with_label, int with_val)
 
static void usage (int eval)
 
static FILE * openF (char *fname, char *mode)
 
static void init (int argc, char **argv, parms_t *p)
 
int main (int argc, char *argv[])
 

Variables

static char * cmd
 
static char * useString
 

Macro Definition Documentation

◆ ND_id

#define ND_id (   n)    (((Agnodeinfo_t*)(n->base.data))->id)

Definition at line 39 of file mm2gv.c.

◆ STANDALONE

#define STANDALONE

Definition at line 19 of file mm2gv.c.

Function Documentation

◆ hue2rgb()

static char * hue2rgb ( double  hue,
agxbuf xb 
)
static

Definition at line 58 of file mm2gv.c.

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

Referenced by makeDotGraph().

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

◆ Hue2RGB()

static double Hue2RGB ( double  v1,
double  v2,
double  H 
)
static

Definition at line 43 of file mm2gv.c.

Referenced by hue2rgb().

Here is the caller graph for this function:

◆ init()

static void init ( int  argc,
char **  argv,
parms_t p 
)
static

Definition at line 235 of file mm2gv.c.

References parms_t::bipartite, BIPARTITE_ALWAYS, cmd, parms_t::inf, parms_t::infile, openF(), parms_t::outf, parms_t::undirected, UNREACHABLE, usage, parms_t::with_color, parms_t::with_label, and parms_t::with_val.

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 293 of file mm2gv.c.

References A, agwrite(), B, parms_t::bipartite, BIPARTITE_PATTERN_UNSYM, dim, graphviz_exit(), parms_t::inf, parms_t::infile, init(), makeDotGraph(), NULL, parms_t::outf, SparseMatrix_delete(), SparseMatrix_import_matrix_market(), SparseMatrix_make_undirected(), SparseMatrix_to_square_matrix(), parms_t::undirected, usage, parms_t::with_color, parms_t::with_label, and parms_t::with_val.

Here is the call graph for this function:

◆ makeDotGraph()

static Agraph_t * makeDotGraph ( SparseMatrix  A,
char *  name,
int  dim,
double *  x,
int  with_color,
int  with_label,
int  with_val 
)
static

Definition at line 73 of file mm2gv.c.

References A, agattr(), agbindrec(), Agdirected, AGEDGE, agedge(), agfstnode(), agnode(), agnxtnode(), agopen(), AGRAPH, Agundirected, agxbfree(), agxbprint(), agxbuse(), agxset(), color(), dim, distance(), free(), gv_calloc(), hue2rgb(), MATRIX_TYPE_REAL, ND_id, NULL, and strip_dir().

Referenced by main().

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

◆ openF()

static FILE * openF ( char *  fname,
char *  mode 
)
static

Definition at line 213 of file mm2gv.c.

References fname, and graphviz_exit().

Referenced by init().

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

◆ usage()

static void usage ( int  eval)
static

Definition at line 207 of file mm2gv.c.

References cmd, eval(), graphviz_exit(), and useString.

Here is the call graph for this function:

Variable Documentation

◆ cmd

char* cmd
static

Definition at line 41 of file mm2gv.c.

Referenced by init(), and usage().

◆ useString

char* useString
static
Initial value:
= "Usage: %s [-uvcl] [-o file] matrix_market_filename\n\
-u - make graph undirected\n\
-U i - treat non-square matrix as a bipartite graph\n\
i = 0 never\n\
i = 1 if pattern unsymmetric (default)\n\
i = 2 if matrix unsymmetric\n\
i = 3 always\n\
-v - assign len to edges\n\
-c - assign color and wt to edges\n\
-l - add label\n\
-o <file> - output file \n"

Definition at line 195 of file mm2gv.c.

Referenced by usage().