Skip to content

Add new options to `dico draw` subcommand

Medina Cardenas, Lorena Giovanna requested to merge dico-graph into master

Description

The purpose of this merge request is to add new options to the dico draw subcommand.

The options are:

  • -s|--group-by-scc: regroup nodes into clusters with respect to the strongly connected components of the dictionary graph
  • -t|--to: to specify the output format (either DOT or PNG)
  • -n|--no-limit: force the execution of the subcommand even if the number of nodes exceeds 100
  • -c|--colorscheme: to colorize the nodes

Examples

When the branch is merged, it will be possible to generate a PNG image as follows:

$ bin/dico draw -i sample/json/477_clock.json -o 477_clock.png -t png -s -c paired12 -n -v

or one might generate a DOT file to customize it manually:

$ bin/dico draw -i sample/json/477_clock.json -o 477_clock.png -t dot -s -n -v
digraph {
	node [colorscheme=x11 penwidth=5 shape=box style=rounded]
	subgraph cluster_0 {
		4 [label="clock;n" color=red]
	}
	subgraph cluster_1 {
		8 [label="day;n" color=red]
[...]
	0 -> 6
	0 -> 29
[...]

Modified files

  • dico.py: to update subcommand help message
  • draw.py: to add options
  • digraph.py: to apply options
  • bats/test_dico_draw.bats: to add new tests
  • README: update for the new options
  • requirements.txt : to import graphviz

Added examples

  • images/477_clock_with_subgraph.png
  • images/small_graph_with_subgraph.png
  • sample/dot/477_clock_with_subgraph.dot
  • sample/dot/small_graph_not_subgraph.dot
  • sample/dot/small_graph_with_subgraph.dot
Edited by Alexandre Blondin Massé

Merge request reports