• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write a dot file?  RSS feed

 
H Johong
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's say if I want to create a dot file that print this graph in Java, how do i go about it?


I'm starting with this:

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wikipedia has some basic information, but the authoritative source is probably http://www.graphviz.org/doc/info/lang.html. I'm not aware of an existing Java library for this.
 
H Johong
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Wikipedia has some basic information, but the authoritative source is probably http://www.graphviz.org/doc/info/lang.html. I'm not aware of an existing Java library for this.



I did this:


but kept getting:
Error: <stdin>:1: syntax error near line 1
context: digraph program >>> 5 <<<

What Syntax error?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the language syntax - program 5 is not a valid ID.
 
H Johong
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Check the language syntax - program 5 is not a valid ID.


I took the space between "program" and "5" out and it worked.

But we were asked to make it program 5. "The first line should state "digraph program 5". I'm not sure what to do about that.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the language spec for what constitutes an ID - there's a way to do that.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
H Johong wrote:But we were asked to make it program 5. "The first line should state "digraph program 5". I'm not sure what to do about that.

Talk to whoever gave you the assignment and explain the problem that you get if you make the first line literally "digraph program 5". Maybe it's just a mistake in the assignment.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!