- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
graphviz
Tue, 2012-01-24, 18:43
Hi,
I've knocked up an API for calling graphviz from scala. I did try some of the Java ones, and they work well, but didn't have the level of integration with scala that I wanted. The code is only a week old, so is probably full of things that need polishing. However, I'd love it if anyone interested could take it for a spin, and see how easy or hard it is to use.
I've briefly described my experience developing this: http://turingatemyhamster.co.uk/blog/?p=157There's a maven-generated site with scaladocs, such as they are: http://drdozer.github.com/graphviz-s/ The github site istelf is: https://github.com/drdozer/graphviz-s
To be honest, right now the best examples are in the test specs. If there's any level of interest, I'll invest time to rectify this.
Thanks,
Matthew
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster@gmail.com gchat: turingatemyhamster@gmail.commsn: matthew_pocock@yahoo.co.uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143
I've knocked up an API for calling graphviz from scala. I did try some of the Java ones, and they work well, but didn't have the level of integration with scala that I wanted. The code is only a week old, so is probably full of things that need polishing. However, I'd love it if anyone interested could take it for a spin, and see how easy or hard it is to use.
I've briefly described my experience developing this: http://turingatemyhamster.co.uk/blog/?p=157There's a maven-generated site with scaladocs, such as they are: http://drdozer.github.com/graphviz-s/ The github site istelf is: https://github.com/drdozer/graphviz-s
To be honest, right now the best examples are in the test specs. If there's any level of interest, I'll invest time to rectify this.
Thanks,
Matthew
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster@gmail.com gchat: turingatemyhamster@gmail.commsn: matthew_pocock@yahoo.co.uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143
Tue, 2012-01-24, 19:11
#2
Re: graphviz
Cool, I wonder if you could retrofit it to this:
http://blog.32leaves.net/?p=861https://github.com/bwmcadams/SyntaxDiagramGenerator
Would make a nice tech demo :)
On 24 January 2012 17:58, Alex Cruise <alex@cluonflux.com> wrote:
http://blog.32leaves.net/?p=861https://github.com/bwmcadams/SyntaxDiagramGenerator
Would make a nice tech demo :)
On 24 January 2012 17:58, Alex Cruise <alex@cluonflux.com> wrote:
On Tue, Jan 24, 2012 at 9:43 AM, Matthew Pocock <turingatemyhamster@gmail.com> wrote:
I've knocked up an API for calling graphviz from scala.
Tasty! License? :)
-0xe1a
Tue, 2012-01-24, 19:41
#3
Re: graphviz
Not chosen one yet - will be something suitably OS - I tend to use LGPL (not GPL), since I understand it and it plays well with mixed commercial/OS applications. Whatever I finally choose will be free-to-use, non-viral. If there's a particular need in the scala community to use one license over another, then I'd take that into consideration.
Matthew
On 24 January 2012 17:58, Alex Cruise <alex@cluonflux.com> wrote:
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster@gmail.com gchat: turingatemyhamster@gmail.commsn: matthew_pocock@yahoo.co.uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143
Matthew
On 24 January 2012 17:58, Alex Cruise <alex@cluonflux.com> wrote:
On Tue, Jan 24, 2012 at 9:43 AM, Matthew Pocock <turingatemyhamster@gmail.com> wrote:
I've knocked up an API for calling graphviz from scala.
Tasty! License? :)
-0xe1a
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster@gmail.com gchat: turingatemyhamster@gmail.commsn: matthew_pocock@yahoo.co.uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143
Tue, 2012-01-24, 19:51
#4
Re: graphviz
On Tue, Jan 24, 2012 at 10:22 AM, Matthew Pocock <turingatemyhamster@gmail.com> wrote:
LGPL (or anything less restrictive like Apache, BSD, MIT, ... ) is fine with me, thanks!
-0xe1a
Not chosen one yet - will be something suitably OS - I tend to use LGPL (not GPL), since I understand it and it plays well with mixed commercial/OS applications. Whatever I finally choose will be free-to-use, non-viral. If there's a particular need in the scala community to use one license over another, then I'd take that into consideration.
LGPL (or anything less restrictive like Apache, BSD, MIT, ... ) is fine with me, thanks!
-0xe1a
Wed, 2012-01-25, 14:01
#5
Re: graphviz
Nice
Thu, 2012-01-26, 16:01
#6
Re: graphviz
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 24.01.2012 18:43, schrieb Matthew Pocock:
> Hi,
>
> I've knocked up an API for calling graphviz from scala.
Good idea, nice work.
However, I have a minor critique. I don't understand the usage of the
underscore, which isn't in sync with common coding styles as in:
type T_CompassPt = CompassPt
type T_StatementType = StatementType
type T_GraphType = GraphType
type T_ID = ID
and
def handle_graph (strict: Boolean, graphType: GraphType, id: ...
def handle_nodeStatement (node: NodeId, attributes: ...
Why don't you use CamelCase?
Thu, 2012-01-26, 16:11
#7
Re: graphviz
Hi Stefan,
Yeah, you're right about the underscores being a bit idiosyncratic. Thanks for your comment. I'm using the underscored prefix like a namespace - dot is not available without causing confusing name clashes and other characters like $ are frowned upon. I could have gone fully cammel-case, and if people generally want this I shall. I just found that while I was coding this up that the underscored prefixes where easier to read - it's clear that the scope is to the left of it and the type being handled is to the right. For the types I would have preferred to use tau over T_, but shied away from making the code-base Unicode-dependent.
Matthew
On 26 January 2012 14:54, Stefan Wagner <hirnstrom@arcor.de> wrote:
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster@gmail.com gchat: turingatemyhamster@gmail.commsn: matthew_pocock@yahoo.co.uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143
Yeah, you're right about the underscores being a bit idiosyncratic. Thanks for your comment. I'm using the underscored prefix like a namespace - dot is not available without causing confusing name clashes and other characters like $ are frowned upon. I could have gone fully cammel-case, and if people generally want this I shall. I just found that while I was coding this up that the underscored prefixes where easier to read - it's clear that the scope is to the left of it and the type being handled is to the right. For the types I would have preferred to use tau over T_, but shied away from making the code-base Unicode-dependent.
Matthew
On 26 January 2012 14:54, Stefan Wagner <hirnstrom@arcor.de> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 24.01.2012 18:43, schrieb Matthew Pocock:
> Hi,
>
> I've knocked up an API for calling graphviz from scala.
Good idea, nice work.
However, I have a minor critique. I don't understand the usage of the
underscore, which isn't in sync with common coding styles as in:
type T_CompassPt = CompassPt
type T_StatementType = StatementType
type T_GraphType = GraphType
type T_ID = ID
and
def handle_graph (strict: Boolean, graphType: GraphType, id: ...
def handle_nodeStatement (node: NodeId, attributes: ...
Why don't you use CamelCase?
- --
Tschööö--->...Stefan
- ---------------------------
Don't visit my homepage at:
http://home.arcor-online.net/hirnstrom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk8haRsACgkQQeATqGpDnRquOwCeOroiczHjfASGKt/Rxp8kBrSE
T68AniThN8FcIv17JXuFslT7LMu80c6b
=a2a4
-----END PGP SIGNATURE-----
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster@gmail.com gchat: turingatemyhamster@gmail.commsn: matthew_pocock@yahoo.co.uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143
Thu, 2012-01-26, 17:51
#8
Re: graphviz
I agree: I have always found that changing
MyName
to
TMyName
makes it hard to read.
T_MyName
is easier.
(This applies primarily to single-letter identifiers, but also to cases where there is a natural separation.)
--Rex
On Thu, Jan 26, 2012 at 10:05 AM, Matthew Pocock <turingatemyhamster@gmail.com> wrote:
MyName
to
TMyName
makes it hard to read.
T_MyName
is easier.
(This applies primarily to single-letter identifiers, but also to cases where there is a natural separation.)
--Rex
On Thu, Jan 26, 2012 at 10:05 AM, Matthew Pocock <turingatemyhamster@gmail.com> wrote:
Hi Stefan,
Yeah, you're right about the underscores being a bit idiosyncratic. Thanks for your comment. I'm using the underscored prefix like a namespace - dot is not available without causing confusing name clashes and other characters like $ are frowned upon. I could have gone fully cammel-case, and if people generally want this I shall. I just found that while I was coding this up that the underscored prefixes where easier to read - it's clear that the scope is to the left of it and the type being handled is to the right. For the types I would have preferred to use tau over T_, but shied away from making the code-base Unicode-dependent.
Matthew
On 26 January 2012 14:54, Stefan Wagner <hirnstrom@arcor.de> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 24.01.2012 18:43, schrieb Matthew Pocock:
> Hi,
>
> I've knocked up an API for calling graphviz from scala.
Good idea, nice work.
However, I have a minor critique. I don't understand the usage of the
underscore, which isn't in sync with common coding styles as in:
type T_CompassPt = CompassPt
type T_StatementType = StatementType
type T_GraphType = GraphType
type T_ID = ID
and
def handle_graph (strict: Boolean, graphType: GraphType, id: ...
def handle_nodeStatement (node: NodeId, attributes: ...
Why don't you use CamelCase?
- --
Tschööö--->...Stefan
- ---------------------------
Don't visit my homepage at:
http://home.arcor-online.net/hirnstrom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk8haRsACgkQQeATqGpDnRquOwCeOroiczHjfASGKt/Rxp8kBrSE
T68AniThN8FcIv17JXuFslT7LMu80c6b
=a2a4
-----END PGP SIGNATURE-----
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster@gmail.com gchat: turingatemyhamster@gmail.commsn: matthew_pocock@yahoo.co.uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143
Tue, 2012-02-07, 19:31
#9
Re: graphviz
Hello Matthew,
could you please point me to an example for a simple invocation of
your API?
For instance, how should I proceed if I wanted to draw a graph having
the arcs (1~>2, 2~>3, 3~>1) with 1, 2 and 3 being the node labels?
Peter
Sat, 2012-02-11, 02:01
#10
Re: graphviz
It'd be great to have easy methods for creating images. Some are very
straightforward with the present implementation, but are still a bit
of work.
def dot2svg(dotgraph: String) = {
import uk.co.turingatemyhamster.graphvizs.exec._
import uk.co.turingatemyhamster.graphvizs.exec.InputHandler._
import uk.co.turingatemyhamster.graphvizs.exec.OutputHandler._
import sys.process.ProcessIO
val errHandler = OutputHandler.stringOutputHandler
val inputHandler = StringInputHandler
val outputHandler = OutputHandler.stringOutputHandler
val io = new ProcessIO(inputHandler.handle(dotgraph),
outputHandler.handle, errHandler.handle, false)
val proc = dotapp.process run io
proc.exitValue() match {
case 0 => outputHandler.value
case x => sys.error("Dot exited with error code: " + x + " with
output:\n" + errHandler.value)
}
}
Peace. Michael
On Tue, Jan 24, 2012 at 9:43 AM, Matthew Pocock
wrote:
> Hi,
>
> I've knocked up an API for calling graphviz from scala. I did try some of
> the Java ones, and they work well, but didn't have the level of integration
> with scala that I wanted. The code is only a week old, so is probably full
> of things that need polishing. However, I'd love it if anyone interested
> could take it for a spin, and see how easy or hard it is to use.
>
> I've briefly described my experience developing
> this: http://turingatemyhamster.co.uk/blog/?p=157
> There's a maven-generated site with scaladocs, such as they
> are: http://drdozer.github.com/graphviz-s/
> The github site istelf is: https://github.com/drdozer/graphviz-s
>
> To be honest, right now the best examples are in the test specs. If there's
> any level of interest, I'll invest time to rectify this.
>
> Thanks,
>
> Matthew
>
> --
> Dr Matthew Pocock
> Integrative Bioinformatics Group, School of Computing Science, Newcastle
> University
> mailto: turingatemyhamster@gmail.com
> gchat: turingatemyhamster@gmail.com
> msn: matthew_pocock@yahoo.co.uk
> irc.freenode.net: drdozer
> skype: matthew.pocock
> tel: (0191) 2566550
> mob: +447535664143
>
Tasty! License? :)
-0xe1a