gtool#

circ_position#

gunfolds.viz.gtool.circ_position(gg)[source]#

Generates node positions for graph-tool graph that arrange them in a ring

Parameters:

gg (a graph-tool object of class Graph) – graph-tool graph object

colorcomponents#

gunfolds.viz.gtool.colorcomponents(gr)[source]#

Assigns a color to each vertex to ensure that vertices from the same strongly connected component have the same color.

By default 12 distinct colors from colorbrewer2 quantitative palette are used and anything beyond that is assigned a white color. In the future that behaviour may change to assigning random colors or to assigning useful semantics to color temperature or shade (such as SCC density or size).

Parameters:

gr (a graph-tool object of class Graph) – graph-tool graph

every_edge_control_points#

gunfolds.viz.gtool.every_edge_control_points(n)[source]#

Generate a graph-tool Graph class object with all possible edges (a superclicue).

The function generates a graph and populates all parameters for all edges. It first does not include the bidirected adges to compute the control_points for directed edges so that they all curve. Subsequently it adds bidirected (red) edges and resets their control points to have all bidirected edges be rendered as straight lines.

Parameters:

n (integer) – number of nodes

Returns:

graph-tool graph

Return type:

a graph-tool object of class Graph

g2gt#

gunfolds.viz.gtool.g2gt(g)[source]#

Converts a gunfolds graph to an object of class Graph of graph-tool package. This includes setting all parameters of edges and vertices but vertex colors.

Parameters:

g (dictionary (gunfolds graphs)) – gunfolds graph

Returns:

graph-tool graph

Return type:

a graph-tool object of class Graph

getscreensize#

gunfolds.viz.gtool.getscreensize()[source]#

Returns a tuple (w,h) with the largest width w and height h among all connected monitors.

Returns:

a tuple (w,h)

Return type:

a tuple with integer values

gt2g#

gunfolds.viz.gtool.gt2g(gr, dir_c='k', bidir_c='r')[source]#

Converts a graph-tool object of class Graph to gunfolds graph

Parameters:

gr (dictionary(gunfolds graph)) – gunfolds graph

Returns:

gunfolds graph

Return type:

dictionary (gunfolds graphs)

hshift#

gunfolds.viz.gtool.hshift(g, shift)[source]#

Horizontally shift positions of all nodes of graph-tool graph g by the value of shift

Parameters:
  • g (a graph-tool object of class Graph) – graph-tool graph

  • shift (float) – shift value

linegraph#

gunfolds.viz.gtool.linegraph(glist, sccs=True)[source]#

Takes a list of gunfolds graphs and merges them into a single Graph class graph-tool object taking care of node positions of each graph to ensure that the constituent graphs are arranged in a single raw when plotted.

Parameters:
  • glist (list of dictionaries (gunfolds graphs)) – a list of gunfold graphs

  • sccs (boolean) – whether to distinguish SCCs by color

Returns:

graph-tool graph

Return type:

a graph-tool object of class Graph

plotg#

gunfolds.viz.gtool.plotg(g, sccs=True, output=None, fmt='auto')[source]#

Given a gunfolds graph, plots it in an interactive window

Parameters:
  • g (dictionary (gunfolds graphs)) – gunfolds graph

  • sccs (boolean) – whether to distinguish SCCs by color

  • output (string or file object (optional, default: None)) – Output file name (or object). If not given, the graph will be displayed via interactive_window().

  • fmt (string or file object (optional, default: None)) – Output file format. Possible values are "auto", "ps", "pdf", "svg", and "png". If the value is "auto", the format is guessed from the output parameter.

plotgunfolds#

gunfolds.viz.gtool.plotgunfolds(g, sccs=True, output=None, fmt='auto')[source]#

Given a gunfolds graph plots all of its undersamples versions arranged sequentially in a horizontal line.

Parameters:
  • g (dictionary (gunfolds graphs)) – gunfolds graph

  • interactive (boolean) – whether to make the window interactive

  • sccs (boolean) – whether to distinguish SCCs by color

  • output (string or file object (optional, default: None)) – Output file name (or object). If not given, the graph will be displayed via interactive_window().

  • fmt (string or file object (optional, default: None)) – Output file format. Possible values are "auto", "ps", "pdf", "svg", and "png". If the value is "auto", the format is guessed from the output parameter.