Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
minglemain.cpp File Reference
#include "config.h"
#include "../tools/openFile.h"
#include <algorithm>
#include <cgraph/cgraph.h>
#include <cgraph/ingraphs.h>
#include <getopt.h>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <unordered_map>
#include <utility>
#include <util/exit.h>
#include <vector>
#include <sparse/DotIO.h>
#include <mingle/edge_bundling.h>
#include <mingle/nearest_neighbor_graph.h>
Include dependency graph for minglemain.cpp:

Go to the source code of this file.

Data Structures

struct  etoi_t
 
struct  opts_t
 
struct  PointHash
 a hash derivation function for int pairs More...
 

Macros

#define ED_idx(e)   (((etoi_t*)AGDATA(e))->idx)
 

Typedefs

using PointMap = std::unordered_map< std::pair< int, int >, int, PointHash >
 

Enumerations

enum  fmt_t { FMT_GV , FMT_SIMPLE }
 

Functions

static void usage (int eval)
 
static int checkG (Agraph_t *g)
 
static void init (int argc, char *argv[], opts_t &opts)
 
static void genBundleSpline (const pedge &edge, std::ostream &os)
 
static void genBundleInfo (const pedge &edge, std::ostream &os)
 
static void genBundleColors (const pedge &edge, std::ostream &os, double maxwgt)
 
static void export_dot (FILE *fp, int ne, const std::vector< pedge > &edges, Agraph_t *g)
 
static int bundle (Agraph_t *g, const opts_t &opts)
 
int main (int argc, char *argv[])
 

Variables

static char * fname
 
static FILE * outfile
 
static char ** Files
 
static const char use_msg []
 

Macro Definition Documentation

◆ ED_idx

#define ED_idx (   e)    (((etoi_t*)AGDATA(e))->idx)

Definition at line 39 of file minglemain.cpp.

Typedef Documentation

◆ PointMap

using PointMap = std::unordered_map<std::pair<int, int>, int, PointHash>

Definition at line 364 of file minglemain.cpp.

Enumeration Type Documentation

◆ fmt_t

enum fmt_t
Enumerator
FMT_GV 
FMT_SIMPLE 

Definition at line 29 of file minglemain.cpp.

Function Documentation

◆ bundle()

static int bundle ( Agraph_t g,
const opts_t opts 
)
static

Definition at line 366 of file minglemain.cpp.

References A, agbindrec(), agerr(), agerrorf(), agfstnode(), agfstout(), aghead, agnameof(), agnxtnode(), agnxtout(), AGPREV, agtail, opts_t::angle, opts_t::angle_param, B, checkG(), opts_t::compatibility_method, dim, ED_idx, edge_bundling(), export_dot(), opts_t::fmt, FMT_GV, fname, FORMAT_CSR, free(), getDotNodeID(), initDotIO(), opts_t::K, opts_t::max_recursion, opts_t::method, nearest_neighbor_graph(), opts_t::nneighbors, opts, opts_t::outer_iter, outfile, pedge_export_gv(), setDotNodeID(), SparseMatrix_delete(), SparseMatrix_import_dot(), SparseMatrix_symmetrize(), and Verbose.

Referenced by main().

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

◆ checkG()

static int checkG ( Agraph_t g)
static

Definition at line 84 of file minglemain.cpp.

References agfstnode(), agfstout(), aghead, agnxtnode(), and agnxtout().

Referenced by bundle().

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

◆ export_dot()

static void export_dot ( FILE *  fp,
int  ne,
const std::vector< pedge > &  edges,
Agraph_t g 
)
static

Definition at line 312 of file minglemain.cpp.

References agattr(), AGEDGE, agfstnode(), agfstout(), agnxtnode(), agnxtout(), agwrite(), agxset(), ED_idx, edge, genBundleColors(), genBundleInfo(), and genBundleSpline().

Referenced by bundle().

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

◆ genBundleColors()

static void genBundleColors ( const pedge edge,
std::ostream &  os,
double  maxwgt 
)
static

Definition at line 282 of file minglemain.cpp.

References dim, edge, and len().

Referenced by export_dot().

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

◆ genBundleInfo()

static void genBundleInfo ( const pedge edge,
std::ostream &  os 
)
static

Definition at line 264 of file minglemain.cpp.

References dim, and edge.

Referenced by export_dot().

Here is the caller graph for this function:

◆ genBundleSpline()

static void genBundleSpline ( const pedge edge,
std::ostream &  os 
)
static

Definition at line 236 of file minglemain.cpp.

References dim, and edge.

Referenced by export_dot().

Here is the caller graph for this function:

◆ init()

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

Definition at line 102 of file minglemain.cpp.

References opts_t::angle, opts_t::angle_param, cmd, COMPATIBILITY_FULL, opts_t::compatibility_method, Files, opts_t::fmt, FMT_GV, FMT_SIMPLE, opts_t::K, M_PI, opts_t::max_recursion, opts_t::method, METHOD_INK, METHOD_INK_AGGLOMERATE, opts_t::nneighbors, openFile(), opts, opts_t::outer_iter, outfile, 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 459 of file minglemain.cpp.

References agclose(), agnameof(), bundle(), fileName(), Files, fname, graphviz_exit(), init(), newIngraph(), nextGraph(), opts, prev, and Verbose.

Here is the call graph for this function:

◆ usage()

static void usage ( int  eval)
static

Definition at line 73 of file minglemain.cpp.

References eval(), graphviz_exit(), and use_msg.

Here is the call graph for this function:

Variable Documentation

◆ Files

char** Files
static

Definition at line 55 of file minglemain.cpp.

Referenced by init(), and main().

◆ fname

char* fname
static

Definition at line 53 of file minglemain.cpp.

Referenced by bundle(), and main().

◆ outfile

FILE* outfile
static

Definition at line 54 of file minglemain.cpp.

Referenced by bundle(), and init().

◆ use_msg

const char use_msg[]
static
Initial value:
=
"Usage: mingle <options> <file>\n\
-a t - max. turning angle [0-180] (40)\n\
-c i - compatability measure; 0 : distance, 1: full (default)\n\
-i iter: number of outer iterations/subdivisions (4)\n\
-k k - number of neighbors in the nearest neighbor graph of edges (10)\n\
-K k - the force constant\n\
-m method - method used. 0 (force directed), 1 (agglomerative ink saving, default), 2 (cluster+ink saving)\n\
-o fname - write output to file fname (stdout)\n\
-p t - balance for avoiding sharp angles\n\
The larger the t, the more sharp angles are allowed\n\
-r R - max. recursion level with agglomerative ink saving method (100)\n\
-T fmt - output format: gv (default) or simple\n\
-v - verbose\n"

Definition at line 57 of file minglemain.cpp.

Referenced by usage().