[Orgmode] Re: From state table to state diagram

2010-11-23 Thread Vladimir Alexiev
You first need to decide on a syntax: 
how many cols in the table and what do they 
mean.

A Confluence plugin does that. You may want to check it out for inspiration and 
nice examples:
https://studio.plugins.atlassian.com/wiki/display/GVIZ/Confluence+Graphviz+Plugin
https://studio.plugins.atlassian.com/wiki/display/GVIZ/Graph-from-table+Macro

Dot is a really simple language, so translating to it should be easy. Eg
  | state1 | state2 | transition |
becomes
  state1 - state2 [label=transition]


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: From state table to state diagram

2010-09-28 Thread Rainer M Krug
I just started, in another context, to look into radio tables, and I thought
- wouldn't this be an option? I mean - putting a radio table into a plantuml
block and translating it, should not be to difficult? And it would be
perfectly in line with org. The same could be done for graphviz.

Just an idea,

Cheers,

Rainer


On Mon, Sep 27, 2010 at 8:27 AM, Gary emacs-orgm...@garydjones.name wrote:

 Rainer M Krug wrote:

  I really like the idea of this conversion from a State Transition Table
 to a
  State Transition Diagram as it is much easier to make a table then a
  graph.

 Easier to maintain, too - I ahte trying to reorganise all the transition
 arrows when I change something :))

  Unfortunately I don't know enough of python to help here.

 I'm learning it in order to do this :P

  Could you please publish your solution here (and on worg) as it would be
 a
  very useful addition to org.

 Sure :)


 ___
 Emacs-orgmode mailing list
 Please use `Reply All' to send replies to the list.
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode




-- 
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)321 2125 2244
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: From state table to state diagram

2010-09-27 Thread Mark Elston

Gary,

One other request for you to entertain.  When you get into the Python
code (I can help with this, if you need it) think about organizing it
such  that you can use multiple output mechanisms.  For example, default
it to use dot as you have been talking about but allow for the use of
tikz as Erik Fraga mentioned in August.  This would imply converting to
some intermediate representation from the table form and then passing
that data to a dynamically selected back-end output engine.

I suggest tikz as an alternative since it can make such beautiful
graphs.

I haven't made use of babel yet so I don't know all its ins and outs
but I expect that there are ways of passing additional information to
the language doing the heavy lifting so we could add various output
modules...

Mark

On 9/26/2010 11:27 PM, Gary wrote:

Rainer M Krug wrote:


I really like the idea of this conversion from a State Transition Table to a
State Transition Diagram as it is much easier to make a table then a
graph.


Easier to maintain, too - I ahte trying to reorganise all the transition
arrows when I change something :))


Unfortunately I don't know enough of python to help here.


I'm learning it in order to do this :P


Could you please publish your solution here (and on worg) as it would be a
very useful addition to org.


Sure :)



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: From state table to state diagram

2010-09-25 Thread Rainer M Krug
Hi

I really like the idea of this conversion from a State Transition Table to a
State Transition Diagram as it is much easier to make a table then a graph.
Unfortunately I don't know enough of python to help here.
Could you please publish your solution here (and on worg) as it would be a
very useful addition to org.

Cheers,

Rainer


On Thu, Sep 23, 2010 at 5:02 PM, Gary emacs-orgm...@garydjones.name wrote:

 Sorry, I've been rather lax on this :( I got dragged onto other stuff,
 went on training courses, and all sorts of other things.

 Eric Schulte wrote:
  Babel does support generating diagrams with graphviz via dot code
  blocks.  Babel is also capable of converting Org-mode tables to list
  objects in a number of languages, so I'd recommend writing a table-dot
  script in your favorite language, and then using babel to handle the
  coordination and Org-mode integration.

 That's all very easy for you to say :))

  I'm happy to help in this regard, the first step would be something like
  the following example which assumes python is your preferred scripting
  language (as you can see I have no idea what your state table may look
  like)...

 Well, wikipedia suggests the following[1] (and goes into further detail
 as well[2])
| Current State - | State | State | State |
| Input   v|   A   |   B   |   C   |
|--+---+---+---|
| x|   B   | ...   | ...   |
| y| ...   |   C   | ...   |
 which basically says that when the machine is in State A and receives
 'x' then it transitions to State B, and when it receives a 'y' in State
 B it transitions to State C.

  #+results: state-table
  | 1 | 2 |
  | 3 | 4 |
 
  #+source: table-to-dot
  #+begin_src python :var table=state-table
python code here

 Okay. What should this python code here do? :) I know, it converts a
 table to dot-script, but are there any examples I could look at which
 take a table as input and output something (anything), just so I can see
 how the python code should expect its input?

  #+end_src
 
  #+begin_src dot :var text=table-to-dot(table=state-table)
graph{
  $text
}
  #+end_src
 
  Once this is working I think it could make a great addition to the
  library of babel [1] (a collection of generally useful code blocks).

 Sure :)

 [1]
 http://en.wikipedia.org/wiki/Finite-state_machine#Concepts_and_vocabulary
 [2] http://en.wikipedia.org/wiki/State_transition_table


 ___
 Emacs-orgmode mailing list
 Please use `Reply All' to send replies to the list.
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode




-- 
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)321 2125 2244
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: From state table to state diagram

2010-09-24 Thread Dan Davison
Gary emacs-orgm...@garydjones.name writes:

 Sorry, I've been rather lax on this :( I got dragged onto other stuff,
 went on training courses, and all sorts of other things.

 Eric Schulte wrote:
 Babel does support generating diagrams with graphviz via dot code
 blocks.  Babel is also capable of converting Org-mode tables to list
 objects in a number of languages, so I'd recommend writing a table-dot
 script in your favorite language, and then using babel to handle the
 coordination and Org-mode integration.

 That's all very easy for you to say :))

 I'm happy to help in this regard, the first step would be something like
 the following example which assumes python is your preferred scripting
 language (as you can see I have no idea what your state table may look
 like)...

 Well, wikipedia suggests the following[1] (and goes into further detail
 as well[2])
 | Current State - | State | State | State |
 | Input   v|   A   |   B   |   C   |
 |--+---+---+---|
 | x|   B   | ...   | ...   |
 | y| ...   |   C   | ...   |
 which basically says that when the machine is in State A and receives
 'x' then it transitions to State B, and when it receives a 'y' in State
 B it transitions to State C.

 #+results: state-table
 | 1 | 2 |
 | 3 | 4 |

 #+source: table-to-dot
 #+begin_src python :var table=state-table
   python code here

 Okay. What should this python code here do? :) I know, it converts a
 table to dot-script, but are there any examples I could look at which
 take a table as input and output something (anything), just so I can see
 how the python code should expect its input?

Hi Gary,

The answer is that python receives that as [[1, 2], [3, 4]]. There are a
few ways to arrive at that answer. For your table-to-dot script I
suspect it is going to be easiest to use the :results output header
argument, which means that the result will be the printed output of the
python block (as opposed to...[1]). So using that, one way to see how
python receives its input is:

#+source: table-to-dot
#+begin_src python :var table=state-table :results output
  print str(table)
#+end_src

#+results: table-to-dot
: [[1, 2], [3, 4]]

Another way is to place point in the code block and use C-c C-v C-v
`org-babel-expand-src-block'.

Alternatively, you might want to use a session to play around with the
input data structure interactively. In that case, add :session, and
use either C-u C-c C-v C-z or C-u C-c C-v z to bring up the emacs python
session with the input variable pre-loaded.

Dan


 #+end_src

 #+begin_src dot :var text=table-to-dot(table=state-table)
   graph{
 $text
   }
 #+end_src

 Once this is working I think it could make a great addition to the
 library of babel [1] (a collection of generally useful code blocks).

 Sure :)

 [1] http://en.wikipedia.org/wiki/Finite-state_machine#Concepts_and_vocabulary
 [2] http://en.wikipedia.org/wiki/State_transition_table


 ___
 Emacs-orgmode mailing list
 Please use `Reply All' to send replies to the list.
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Footnotes:

[1] As opposed to the default mode in which the result of the block is
the value of the last statement, turned into an Org-mode table if it is
a list/vector type object.

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: From state table to state diagram

2010-08-24 Thread Eric S Fraga
On Tue, 24 Aug 2010 14:06:32 +0200, Gary orgm...@garydjones.name wrote:
 
 Eric S Fraga wrote:
 
  Sorry, that should have been graphviz... typing on a phone.  :-( 
 
 :))
 
 Okay, thanks. I know about graphviz, but it is not really what I am
 looking for. Ideally I would create a state transition table and then
 just magically get a diagram as a by-product. I can definitely see
 that the DOT language might be a good target though - generating that
 from a table should be easier than generating a diagram directly.

Yes, that is what I was thinking (but did not want to type on the
little on-screen keyboard of my phone...) when I suggested graphviz:
dot could be a good intermediate language.

 Well, maybe it's a bit specific and nobody has done anything so I should
 look into it on my own :)

It is indeed specific but I think there would be some interest in what
you manage to concoct so please post it here!  

If I were to have time to do this right now, I would probably use awk
to convert a state transition table to a dot graph representation but
only because I'm very comfortable with awk and much less so with emacs
lisp...

And the ease will depend on the type of transition table you have as
the starting point, of course...

As an aside, when it comes to actually generating a diagram, I would
in practive typically use tikz due to the quality of the graphs that
can be achieved.  However, it may be harder to do a table \to tikz
translation automatically.
-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: From state table to state diagram

2010-08-24 Thread Eric Schulte
Babel does support generating diagrams with graphviz via dot code
blocks.  Babel is also capable of converting Org-mode tables to list
objects in a number of languages, so I'd recommend writing a table-dot
script in your favorite language, and then using babel to handle the
coordination and Org-mode integration.

I'm happy to help in this regard, the first step would be something like
the following example which assumes python is your preferred scripting
language (as you can see I have no idea what your state table may look
like)...

--8---cut here---start-8---
#+results: state-table
| 1 | 2 |
| 3 | 4 |

#+source: table-to-dot
#+begin_src python :var table=state-table
  python code here
#+end_src

#+begin_src dot :var text=table-to-dot(table=state-table)
  graph{
$text
  }
#+end_src
--8---cut here---end---8---

Once this is working I think it could make a great addition to the
library of babel [1] (a collection of generally useful code blocks).

Cheers -- Eric

Gary orgm...@garydjones.name writes:

 Eric S Fraga wrote:

 Sorry, that should have been graphviz... typing on a phone.  :-( 

 :))

 Okay, thanks. I know about graphviz, but it is not really what I am
 looking for. Ideally I would create a state transition table and then
 just magically get a diagram as a by-product. I can definitely see
 that the DOT language might be a good target though - generating that
 from a table should be easier than generating a diagram directly.

 Well, maybe it's a bit specific and nobody has done anything so I should
 look into it on my own :)

Footnotes: 
[1]  http://orgmode.org/worg/org-contrib/babel/library-of-babel.php

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode