Discussion:
How to use a graphviz program in the draw_graph function
(too old to reply)
Hans-Peter Vietze
2017-06-24 06:38:12 UTC
Permalink
Raw Message
I tried to use one of the graphviz functions to visualize a graph, but
did not succeed. I tried the attempt of Michel Talon but got an error
message:

-->
Nachricht vom stdout von wxMaxima: Maxima 5.39.0_2_g5a49f11_dirty
http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1)
--> load(graphs);
0 errors, 0 warnings
0 errors, 0 warnings
(%o1)
"C:\maxima-5.39.0\share\maxima\5.39.0_2_g5a49f11_dirty\share\graphs\graphs.mac"
-->
g:create_graph(16,[[0,1],[1,3],[2,3],[0,2],[3,4],[2,4],[5,6],[6,4],[4,7],[6,7],[7,8],[7,10],[7,11],[8,10],[11,10],[8,9],[11,12],[9,15],[12,13],[10,14],[15,14],[13,14]]);
(g) GRAPH\(16 vertices, 22 edges\)
--> mi:max_independent_set(g);
(mi) [0,3,5,8,11,13,15]
--> draw_graph(g,redraw=true,program=dot);
first: empty argument.
#0: draw_graph(g=GRAPH\(16\ vertices\,\ 22\ edges\),options=[redraw
= true,program = dot])
(C:\maxima-5.39.0\share\maxima\5.39.0_2_g5a49f11_dirty\share\graphs\draw_graph.mac
line 166)
-- an error. To debug this try: debugmode(true);
Message from maxima's stderr stream: Der Befehl "dot" ist entweder
falsch geschrieben oder
konnte nicht gefunden werden.
first: empty argument.
#0: draw_graph(g=GRAPH\(16\ vertices\,\ 22\ edges\),options=[redraw
= true,program = dot])
(C:\maxima-5.39.0\share\maxima\5.39.0_2_g5a49f11_dirty\share\graphs\draw_graph.mac
line 166)
-- an error. To debug this try: debugmode(true);

I then added the path of the dot.exe in the file_search_maxima path
list, which did not help:

-->
append(file_search_maxima,["C:/Programme(x86)/Graphviz2.38/bin{exe}"]);
(%o27)
["C:/Users/Admin2/maxima/$$$.{mac,mc,wxm}","C:\maxima-5.39.0\bin\\../share/maxima/5.39.0_2_g5a49f11_dirty/share/$$$.{mac,mc,wxm}","C:\maxima-5.39.0\bin\\../share/maxima/5.39.0_2_g5a49f11_dirty/share/{affine,algebra,algebra/charsets,algebra/solver,amatrix,bernstein,calculus,cobyla,cobyla/ex,cobyla/lisp,colnew,colnew/ex1,colnew/ex2,colnew/ex3,colnew/ex4,colnew/lisp,combinatorics,contrib,contrib/Eulix,contrib/Grobner,contrib/Zeilberger,contrib/alt-display,contrib/altsimp,contrib/binsplit,contrib/bitwise,contrib/boolsimp,contrib/coma,contrib/diffequations,contrib/diffequations/tests,contrib/elliptic_curves,contrib/elliptic_curves/figures,contrib/format,contrib/fresnel,contrib/gentran,contrib/gentran/man,contrib/gentran/test,contrib/gf,contrib/integration,contrib/levin,contrib/lurkmathml,contrib/maxima-odesolve,contrib/maximaMathML,contrib/mcclim,contrib/namespaces,contrib/noninteractive,contrib/odes,contrib/operatingsystem,contrib/prim,contrib/rand,contrib/rkf45,contrib/sarag,contrib/smath,contrib/state,contrib/trigtools,contrib/unicodedata,contrib/unit,contrib/vector3d,descriptive,diff_form,diff_form/tests,diffequations,distrib,draw,dynamics,ezunits,finance,fourier_elim,fractals,graphs,hypergeometric,integequations,integer_sequence,integration,lapack,lapack/blas,lapack/lapack,lbfgs,linearalgebra,logic,lsquares,macro,matrix,minpack,minpack/lisp,misc,mnewton,multiadditive,numeric,numericalio,orthopoly,pdiff,physics,simplex,simplex/Tests,simplification,solve_rat_ineq,solve_rec,sound,stats,stringproc,sym,tensor,to_poly_solve,trigonometry,utils,vector,z_transform}/$$$.{mac,mc,wxm}","C:\maxima-5.39.0\bin\\../share/maxima/5.39.0_2_g5a49f11_dirty/$$$.{mac,mc,wxm}","C:/Programme(x86)/Graphviz2.38/bin{exe}"]

My Sytem configuration is:

Windows10
Maxima5.39.02

Can anybody help me?

Best regards

Hans-Peter
--
Mit freundlichen Grüßen

Dr.Hans-Peter Vietze
Gunter Königsmann
2017-06-24 07:26:58 UTC
Permalink
Raw Message
Post by Hans-Peter Vietze
I then added the path of the dot.exe in the file_search_maxima path
list
You need to add the path to the fole to the PATH Environment variable in
the windows control panel instead and to reboot the system afterwards.

Kind regards,

Gunter.
Michel Talon
2017-06-24 08:50:37 UTC
Permalink
Raw Message
Post by Hans-Peter Vietze
I tried to use one of the graphviz functions to visualize a graph, but
did not succeed. I tried the attempt of Michel Talon but got an error
-->
Nachricht vom stdout von wxMaxima: Maxima 5.39.0_2_g5a49f11_dirty
http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1)
--> load(graphs);
0 errors, 0 warnings
0 errors, 0 warnings
(%o1)
"C:\maxima-5.39.0\share\maxima\5.39.0_2_g5a49f11_dirty\share\graphs\graphs.mac"
-->
g:create_graph(16,[[0,1],[1,3],[2,3],[0,2],[3,4],[2,4],[5,6],[6,4],[4,7],[6,7],[7,8],[7,10],[7,11],[8,10],[11,10],[8,9],[11,12],[9,15],[12,13],[10,14],[15,14],[13,14]]);
(g) GRAPH\(16 vertices, 22 edges\)
--> mi:max_independent_set(g);
(mi) [0,3,5,8,11,13,15]
--> draw_graph(g,redraw=true,program=dot);
first: empty argument.
#0: draw_graph(g=GRAPH\(16\ vertices\,\ 22\ edges\),options=[redraw
= true,program = dot])
(C:\maxima-5.39.0\share\maxima\5.39.0_2_g5a49f11_dirty\share\graphs\draw_graph.mac
line 166)
-- an error. To debug this try: debugmode(true);
Message from maxima's stderr stream: Der Befehl "dot" ist entweder
falsch geschrieben oder
konnte nicht gefunden werden.
I have tried several examples of the documentation for draw_graph and
they work for me, that is a windows appears with the graph drawn.
However i am under Linux and using sbcl, while you are using clisp and
Windows.

In fact your program works on my machine. I see first a compilation of
numericalio, and the the graph is drawn.

One remark: against localization of programs. With localization, when
an error message appears, it is localized, and thus impossible to
understand precisely for someone who doesn't speak the language. For an
open source software this limits the number of people who can help.
English is "lingua franca" for scientific stuff, and allows everyone to
collaborate.

Second: the error at line 166 of draw_graph.mac is not directly related
to dot. The line says
dimension : length(second(first(v_pos)))
which is coherent with
first: empty argument
in other words v_pos is undefined when first is called. But just before
one has
v_pos : apply(program, [G]),
set_positions(v_pos, G)),
I don't know what is set_positions, it is not defined in the file.

Anyways probably your maxima cannot find the dot program. It is called
this way:
if program = 'dot then
command : concat("dot -Tplain \"",
gp_file_in, "\" > \"", gp_file_out, "\"")
...
system(command),

So the invocation
system("dot -Tplain ...") has to succeed. Probably dot has to be in your
path in Windows and perhaps more. The syntax to call external programs
may vary from lisp to lisp, and something which works with sbcl may not
work with clisp. Note it is the path variable of windows which is
impoirtant here, not the file_search_maxima path list.
--
Michel Talon
Gunter Königsmann
2017-06-24 09:02:42 UTC
Permalink
Raw Message
Post by Michel Talon
One remark: against localization of programs. With localization, when
an error message appears, it is localized, and thus impossible to
understand precisely for someone who doesn't speak the language. For an
open source software this limits the number of people who can help.
English is "lingua franca" for scientific stuff, and allows everyone to
collaborate.
Second: the error at line 166 of draw_graph.mac is not directly related
to dot. The line says
dimension : length(second(first(v_pos)))
which is coherent with
first: empty argument
in other words v_pos is undefined when first is called. But just before
one has
v_pos : apply(program, [G]),
set_positions(v_pos, G)),
I don't know what is set_positions, it is not defined in the file.
Anyways probably your maxima cannot find the dot program. It is called
if program = 'dot then
command : concat("dot -Tplain \"",
gp_file_in, "\" > \"", gp_file_out, "\"")
...
system(command),
Translations of error messages are both very helpful and a complete
nuisance.

In this case you were correct: The path to dot.exe wasn't in the windows
installation's PATH environment variable so windows had no idea where to
find this binary.

Kind regards,

Gunter.
Hans-Peter Vietze
2017-06-24 09:51:12 UTC
Permalink
Raw Message
Thank you very much for the very fast and helpful answer. After setting
the path in the windows environment, the error message vanished and I
found the in.txt and out.txt files in the working directory. Sorry for
just copying the german error message in my e-mail. Next time I will
swith to english before asking.

Hans-Peter
Post by Gunter Königsmann
Post by Michel Talon
One remark: against localization of programs. With localization, when
an error message appears, it is localized, and thus impossible to
understand precisely for someone who doesn't speak the language. For an
open source software this limits the number of people who can help.
English is "lingua franca" for scientific stuff, and allows everyone to
collaborate.
Second: the error at line 166 of draw_graph.mac is not directly related
to dot. The line says
dimension : length(second(first(v_pos)))
which is coherent with
first: empty argument
in other words v_pos is undefined when first is called. But just before
one has
v_pos : apply(program, [G]),
set_positions(v_pos, G)),
I don't know what is set_positions, it is not defined in the file.
Anyways probably your maxima cannot find the dot program. It is called
if program = 'dot then
command : concat("dot -Tplain \"",
gp_file_in, "\" > \"", gp_file_out, "\"")
...
system(command),
Translations of error messages are both very helpful and a complete
nuisance.
In this case you were correct: The path to dot.exe wasn't in the windows
installation's PATH environment variable so windows had no idea where to
find this binary.
Kind regards,
Gunter.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Maxima-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
--
Mit freundlichen Grüßen

Dr.Hans-Peter Vietze
Zillering 47
64546 Mörfelden-Walldorf
***@t-online.de
Gunter Königsmann
2017-06-28 17:37:41 UTC
Permalink
Raw Message
Post by Hans-Peter Vietze
Thank you very much for the very fast and helpful answer.
You are welcome ;-)
Post by Hans-Peter Vietze
Sorry for
just copying the german error message in my e-mail. Next time I will
switch to english before asking.
If it is German, Italian, Spanish or Portuguese I will happily translate
the error message. My comment was rather from the point of view that
translated error messages are helpful for native speakers but make it
harder to google or to ask for help. Also I am currently implementing
mouse-over tooltips for wxMaxima for some of the harder-to-resolve error
messages... ...dealing with translations of the error messages, as well,
would loads of complexity to the code here. But perhaps I'll find a way
to make that work, too...

Kind regards,

Gunter.

Loading...