How do I create a state transition diagram?

7,972

Solution 1

Actually Dia does allow you to add an end state. Select the UML shapes, then drag the "initial/end state" shape onto your diagram. When you double click the shape, you'll see a button that says "Is final". This lets you define whether the state is initial or final.

EDIT: If you don't like how those look, it's pretty easy to create your own shapes in Dia. They're just SVG files.

Save the following as ~/.dia/shapes/fsm_final_state.shape :

<?xml version="1.0"?>

<shape xmlns="http://www.daa.com.au/~james/dia-shape-ns"
       xmlns:svg="http://www.w3.org/2000/svg">
  <name>Finite State Machine - Final State</name>
  <icon>fsm_final_state_icon.xpm</icon>
  <connections>
    <point x="0.0" y="2.5" />
    <point x="2.5" y="5.0" />
    <point x="5.0" y="2.5" />
    <point x="2.5" y="0.0" />
  </connections>
  <textbox x1="0.0" y1="0.0" x2="5.0" y2="5.0" />
  <svg:svg width="5.0" height="5.0">
    <svg:circle style="fill: default;" cx="2.5" cy="2.5" r="2.5" />
  </svg:svg>
  <svg:svg width="4.0" height="4.0">
    <svg:circle style="fill: default;" cx="2.5" cy="2.5" r="2.0" />
  </svg:svg>
</shape>

Save the following as ~/.dia/shapes/fsm_final_state_icon.xpm :

/* XPM */
static char * fsm_final_state_icon_xpm[] = {
"16 16 14 1",
"   c None",
".  c #FFFFFF",
"+  c #FCFCFC",
"@  c #B6B6B6",
"#  c #545454",
"$  c #000000",
"%  c #101010",
"&  c #D8D8D8",
"*  c #121212",
"=  c #353535",
"-  c #A0A0A0",
";  c #EBEBEB",
">  c #040404",
",  c #9E9E9E",
"................",
"....+@#$%#@+....",
"...&*=-.;-=*&...",
"..&>,......,>&..",
".+*,........,*+.",
".@=..........=@.",
".#-..........-#.",
".%;..........;%.",
".%;..........;%.",
".#-..........-#.",
".@=..........=@.",
".+*,........,*+.",
"..&>,......,>&..",
"...&*=-.;-=*&...",
"....+@#$%#@+....",
"................"};

Finally, save the following as ~/.dia/sheets/Finite_State_Machine.sheet :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<sheet xmlns="http://www.lysator.liu.se/~alla/dia/dia-sheet-ns">
<!--File: ~/.dia/sheets/Finite_State_Machine.sheet-->

<name>Finite State Machine</name>
<description>Finite state machine diagrams</description>
<contents>
<!--add shapes here-->
<object name="Finite State Machine - Final State">
<description>Final</description></object>

</contents></sheet>

When you restart Dia you should have a "Finite State Machine" sheet with one shape: a decent looking final state!

Solution 2

I suggest you to use inkscape Install inkscape to produce graphics like that, it takes a little time to learn how to use the tools but it is well rewarded with the graphic quality of the product.

Solution 3

I suggest you to use Dia software for your state diagram or any other UML or flow diagrams. It contains numbers of shapes and easy drag drop facilities. So go for dia. For more information visit this link.

Solution 4

Lucidchart is a good option. Free version available and works in any decent browser. I know that there dev team are all running Linux so there is that as well because I work there :)

Share:
7,972

Related videos on Youtube

zouve
Author by

zouve

Updated on September 18, 2022

Comments

  • zouve
    zouve over 1 year

    I am drawing a state transition diagram using LibreOffice draw on Ubuntu 11.04. I am able to get almost everything that I needed except the final state. Typically we use two circles embedded in for showing a final state of a state transition diagram. Could someone help me to do that? Please also let me know if there are any better tools for drawing state transition diagrams on Ubuntu. I have looked at Dia, but it is not also useful to draw final state of a state transition diagram like in this.

  • zouve
    zouve over 12 years
    Thank you. However, it seems that initial and final states are not looking as good as en.wikipedia.org/wiki/File%3aDFAexample.svg Please let me know if you know any other better tools.
  • erturne
    erturne over 12 years
    Edited my answer with an example of how to make your own shapes in Dia. ;-)