-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphVizTest.java
More file actions
70 lines (64 loc) · 1.98 KB
/
Copy pathGraphVizTest.java
File metadata and controls
70 lines (64 loc) · 1.98 KB
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
70
package ʵÑéÒ»;
import java.io.IOException;
public class GraphVizTest {
public void showDirectedGraph(Graph graph) {
GraphViz gViz=new GraphViz("C:\\Users\\lenovo\\Desktop\\eee","D:\\Java¿ÉÊÓ»¯\\bin\\dot.exe" );
gViz.start_graph();
int i1=1,i2=1;
while(graph.list[i1]!=null)
{
gViz.addln(graph.list[i1].data+";");
i2=graph.list[i1].sonnumber;
Point son=graph.list[i1].first;
for(int i=1;i<=i2;i++){
gViz.addln(graph.list[i1].data+"->"+graph.list[son.adj].data+"[label=\""+son.cost+"\"]"+";");
son=son.next;
}
i1++;
}
// gViz.addln("A;");
// gViz.addln("B;");
// gViz.addln("C;");
// gViz.addln("D;");
// gViz.addln("E;");
// gViz.addln("A->B[label=\"100 times\"];");
// gViz.addln("A->C;");
// gViz.addln("C->B;");
// gViz.addln("B->D;");
// gViz.addln("C->E;");
gViz.end_graph();
try {
gViz.run();
} catch (Exception e) {
e.printStackTrace();
}
}
public void showDirectedGraph(Graph graph,String[] ss) {
GraphViz gViz=new GraphViz("C:\\Users\\lenovo\\Desktop\\eee2","D:\\Java¿ÉÊÓ»¯\\bin\\dot.exe" );
gViz.start_graph();
int i1=1,i2=1;
while(graph.list[i1]!=null)
{
gViz.addln(graph.list[i1].data+";");
i2=graph.list[i1].sonnumber;
Point son=graph.list[i1].first;
for(int i=1;i<=i2;i++){
gViz.addln(graph.list[i1].data+"->"+graph.list[son.adj].data+"[label=\""+son.cost+"\"]"+";");
son=son.next;
}
i1++;
}
int count=1;
while(ss[count]!=null)
{
gViz.addln(ss[count-1]+"->"+ss[count]+"[color=\"red\", style=\"dashed\"]"+";");
count++;
}
gViz.end_graph();
try {
gViz.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}