slanted W3C logo
Cover page images (keys)

Miniproject Stage 2:Flow Diagram in Tikz

Prajakta Ayachit

ROLL NUMBER:09305924



Hit the space bar for next slide

Contents

Problem Statement



To provide package for drawing flow diagram.This flow diagram is general and be used to draw various diagrams easily.

Input

The command named "mydia" should be used to draw the diagram.This diagram accepts two parameters in curly braces as:

  1. Triplets of the form s/t/l

    S:Shape of node circular or rectangular
    t:Text to be written inside node
    l:Text to be written on edge
    Triplets should be seperated by comma.

  2. N
    Number of triplets

Output

The Tikz diagram generated according to given description. The diagram has given number of nodes. The nodes can be circular or rectangular.The inputed text is written inside each node.The third parameter for each triplet should be text to be written on ege which will be incident onto this node. The placement of nodes is done automatically and assumes circular shape.The default arrow shape is drawn between two nodes as "->".

Sample diagram generated:Lifecycle of butterfly is :

Sample1
Sample line from .tex file to draw diagram:

\mydia{placep/Process1/,rect/External Entity/,placep/Process2/}{3}

Motivation

The reasons for selecting this as miniproject are as follows:

Features

Basic Idea:

If we observe various diagrams , the basic elemets which are commonly used are circle and rectangle. To connect them we can use various types of arrows.We can use "->" type of arrow commnly. Also if the aim of diagram is to depict the flow between elements then the way in which they are placed is not critical for consideration. So we can assume that the nodes are placed such that they will form a circle approximately.Considering these things the parameters to be accepted for drawing nodes are decided. Also please note that this diagram is not some domain specific such as theory of computation(automata diagrams),Software engineering(data flow diagrams) but it provides basic framework which can be used as per requirement to draw simple diagrams.


Initial proposal

Initially I proposed to draw diagram with following things:

Implemented things

The features currently implemented by command are:

Non-Implemented things of initial proposal

The features which were initially proposed and not implemented by command are:

Extra things implemented

The dynamicity in number of nodes and placing them as well of providing option for shape of node as circle and rectangle were added later.

Break up of time

Phase 1:Learning latex,tikz

Basically I was totally new to Tikz and Latex. So it took 10-15 hours to get familiar with it.

Phase 2:Deciding problem statement

There are many many things for which already library is built and available to use.To find what is already implemented and what can be implemented using that took 5-10 hours.

Phase 3:Implementation

For actual implementation it took some time.Initially I drew diagram without accepting any parameters from user. Then I tried to draw it for some hard-coded parameters.It took time to understand command "\newcommand" used to define macros . Defining .sty as per our requirement was easy. Using these my commands are defined.

Design

The command used for drawing diagram is \mydia.
Following styles are defined:

  1. Style for circular node with blue color
  2. Style for circular node with cyan color
  3. Style for rectangular node



Following commands are defined:

  1. \forloop:To implement for loop.

    It accepts 3 parameters namely:initial value,testing condition,code to be executed when condition is satisfied

  2. \mydia: For drawing actual diagram

    In this command for each triplet ,position of node is calculated and nodes are automatically created as X0,X1,X3,...
    After that using \forloop command edges are drawn between nodes.

Sequence of calling:

User calls /mydia. That in turn creates nodes and calls /forloop for drawing edges.

Implementation

Programming Language:



Modules borrowed:

No modules as such are borrowed directly.



Packages used:

Following packages are used:


Libraries used:

Following libraries are used:

References:

PGF and TikZ manual for Version 2.0

Implementation details:


For this, commands such as \newcounter,\setcounter,\addtocounter commands.

Difficulties faced:

The difficulties were faced when the number of nodes was not fixed. So to place such arbitrary number of nodes calculations were required.This was done by using polar co-ordinates and setteing angle of polar co-ordinate as 360/No of nodes * node number. The node name is generated automatically as X0,X1,....
This naming is useful while connecting nodes.Also defining \forloop resolved the problem of connecting nodes.



Future Work

  1. In future if input can be taken in some format so that any node can be connected to any node(i.e. any number of edges in between two nodes) ,it will be very helpful.
  2. Also placement of nodes can be thought so that they can be placed anywhere but according to user input.

Conclusion

So this package can be used to draw simple diagrams depicting flow between entities,actions,objects in various domains such as medical,pure sciences,management,etc and will reduce efforts and save time.













THANK YOU!!!