forked from claudiosa/CCS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hakank.txt
71 lines (59 loc) · 2.26 KB
/
hakank.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Hi Claudio.
Thanks for your comments.
Your pictures got me curious if one could use graphwiz for showing the graphs.
So I added the following code to print a graphwiz .dot file of the graph. (it's last in http://hakank.org/hakank.org/picat/dist_vertex_claudio.pi )
"""
%
% Print The links to a .dot format
%
% $ dot -Tpdf dist_vertex_claudio.dot -o dist_vertex_claudio.pdf
% $ sfdp -Tpdf dist_vertex_claudio.dot -o dist_vertex_claudio.pdf
% $ neato -Tpdf dist_vertex_claudio.dot -o dist_vertex_claudio.pdf
%
DotFile = "dist_vertex_claudio.dot",
printf("\nThe links in .dot format: %w\n",DotFile),
Writer = open(DotFile,write),
println(Writer,"digraph links {"),
println(Writer,"{\n node [margin=0 fontcolor=blue fontsize=12 width=0.5 shape=dot style=filled]\n}"),
Dot = new_map(),
foreach(G in 1..K_com)
% printf("%d (group %d) -> %d (group: %d) \n",I,Groups[I], X_Nodes[I], Groups[X_Nodes[I]])
ThisGroup = [I : I in 1..Size, Groups[I] == G],
printf(Writer,"subgraph cluster_%d {\n", G),
foreach(T in ThisGroup)
foreach(S in ThisGroup, S != T)
if not(Dot.has_key([T,S].sort)) then
printf(Writer, "%d -> %d\n",S,T),
Dot.put([S,T].sort,1)
end
end
end,
println(Writer,"}"),
end,
foreach(T in 1..Size, T != X_Nodes[T])
if not(Dot.has_key([T,X_Nodes[T]].sort)) then
printf(Writer, "%d -> %d;\n", T, X_Nodes[T]),
Dot.put([T,X_Nodes[T]].sort,1)
end
end,
println(Writer,"}\n"),
close(Writer),
% ...
"""
See the attached PDF file for the output. It's generated by this command (after running the Picat program):
$ dot -Tpdf dist_vertex_claudio.dot -o dist_vertex_claudio.pdf
It's not the same as your graph, and the layout is not best, but is still quite nice...
Best,
Hakan
Área de anexos
Hakan Kjellerstrand (gmail.com)
Hi Hakan
Excelent your graph attached ... it exactly what I am expected.
I never used the graphicz ... but I heard a lot.
ĉĉ - claudio cesar
Whatsapp: +55 47 99245 1825
http://github.com/claudiosa
https://claudiocesar.wordpress.com
https://claudiocesar.wordpress.com/about
https://www.udesc.br/cct/maratona_programacao
***********************************************************************