Skip to content

Instantly share code, notes, and snippets.

View steveroush's full-sized avatar

steveroush

  • nope
  • colorado, usa
View GitHub Profile
@steveroush
steveroush / gvstats.gvpr
Created February 17, 2024 02:10
A GVPR program that reports information about Graphviz files
BEGIN{
int clusterCnt, cHtmlCnt;
graph_t aGraph;
string printBuf;
//////////////// help /////////////////////////////////////////////
string help="
gvstats.gvpr :
a GVPR program that provides information about Graphviz input files
- the file name
- the layout engine (if set)
@steveroush
steveroush / fixOrtho.gvpr
Created December 19, 2023 19:05
Graphviz: fixOrtho - a work-around to allow ortho edges to connect to ports
/*
neato complains about overlapping nodes, kicks our warning message (see below),
and uses splines=false.
"Warning: the bounding boxes of some nodes touch - falling back to straight
line edges"
- to do:
- multi-edge??
@steveroush
steveroush / alter_archive.sh
Last active November 18, 2023 03:08
Graphviz post-processor to customize edges
#!/bin/sh
cat <<QUitquIT
# This is a shell archive.
#
# to execute this file, type: sh alter_archive.sh
#
# On Linux/UNIX/MacOS(?) systems it is an executable program that will create
# a subdirectory (named alter.d) in the currect directory and then
# install multiple (text) files in that directory.
# This shell archive and all contents are humanly readable - no binary files.
@steveroush
steveroush / socioGram.d_archive.sh
Created July 21, 2023 01:50
a radial sociogram shell archive - 3 sociogram creators
#!/bin/sh
cat <<QUitquIT
# This is a shell archive.
#
# to execute this file, type: sh socioGram.d_archive.sh
#
# On Linux/UNIX/MacOS(?) systems it is an executable program that will create
# a subdirectory (named socioGram.d) in the currect directory and then
# install multiple (text) files in that directory.
# This shell archive and all contents are humanly readable - no binary files.
@steveroush
steveroush / addRingLabels.gvpr
Created July 19, 2023 20:19
addRingLabels.gvpr - a companion to twopiCircles.gvpr
/**********************************************************
addRingLabels.gvpr -
a very specialized gvpr program that adds labels to the output of
twopiCircles.gvpr
**********************************************************/
N[name=="____Circle____*"&&ringNo>0]{
$.xlabel=(string)(1 + (int)$.rank);
$.xlp=(string)($.X+(72*($.width/2))) +"," +(string)$.Y;
}
@steveroush
steveroush / setTwopiRanks.gvpr
Last active July 19, 2023 20:07
setTwopiRanks.gvpr - A Graphviz / gvpr script to assign ranks to nodes for the twopi program
/*************************************************************************
setTwopiRanks: explicitly set ranks for nodes in twopi graphs
Though the twopi does not use the term rank (except for the ranksep attribute),
it essentially does (radial) ranking from the root node.
However, while *dot* ranking is (by default) based on longest distance,
twopi ranking is based on soortest (spanning tree) distance.
setTwopiRanks accomplishes the goal in two ways:
- nodes that would have a distance greater than the desired rank will cause invisible nodes and edges added to the graph to "pull" the node in to the desired rank.
- nodes that would have a distance shorter than the desired rank will cause the short edges to be ignored in the rank calculation by appling weight=0 to those edges (see https://graphviz.org/docs/attrs/weight/)
@steveroush
steveroush / twopiCircles.gvpr
Last active July 19, 2023 19:59
A Graphviz gvpr program to add concentric circles to a twopi graph
/*************************************************************************
twopiCircles: add circles to twopi graph
similar to the "addrings" gvpr program that comes with Graphviz source
New Attributes, only used by twopiCircles.gvpr:
- maxRank - set a maximum number of concentric circles (ranks).
Ranks counted from the center, Root is not counted as a rank
- noOffset - if true, draw circles through the center of nodes
otherwise, draw circles between the ranks
(i.e half-way from one rank to the next)
@steveroush
steveroush / improveEdgeLabels.gvpr
Created June 5, 2023 02:21
A GVPR program to improve Graphviz edge labels
/***********************************************
1. save this file as improveEdgeLabels.gvpr
2. what it does: it allows you to re-position Graphviz edge labels
3. command line example (works with any Graphviz engine):
dot myfile.gv |gvpr -cf improveEdgeLabels.gvpr |neato -n2 -Tpng >myfile.png
4. how to use:
improveEdgeLabels adds 3 new edge attributes to Graphviz:
- labelOverlay, labelAdjust, label2Node
- they can be used separately or in combination
- if labelOverlay=true
@steveroush
steveroush / keepOrder_archive.sh
Last active April 17, 2023 14:50
Graphviz node reorder software
#!/bin/sh
cat <<QUitquIT
# This is a shell archive.
#
# to execute this file, type: sh keepOrder_archive.sh
#
# On Linux/UNIX/MacOS(?) systems it is an executable program that will create
# a subdirectory (named keepOrder) in the currect directory and then
# install multiple (text) files in that directory.
# This shell archive and all contents are humanly readable - no binary files.
@steveroush
steveroush / wordWrapShared.sh
Created March 15, 2023 20:56
word wrap for Graphviz
## set -x
## This is a Linux (and maybe MacOS?) shell script.
## It will need to be modified to run on Windows.
## It performs word-wrap (https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap) on the labels of certain Graphviz nodes.
## - not html-like labels
## - not record or Mrecord shaped nodes
## - not edge labels
## - not graph or cluster labels
## - not xlabels
## - it DOES NOT recognize any meaning of TAB character (ASCII 09) or