1

I've been working on a project where I want to have a flow of events. The flow of events is a sort of finite state machine except that the states and transitions aren't initially known. For example:

Event A --[ do nothing ]--> Event B --[ do nothing ]--> Event D
    \                          ^                         ^
     \                [do something else]               /
      \                        |                       /
       \--[do something]--> Event C --[time  passes]--/

I've been using this as an opportunity to learn Backbone.js (among other things), and I was wondering Is there a library for graphs using Backbone models?

I've looked at Workflow.js, but it seems like it is intended for cases where the graph is known initially.

NT3RP
  • 15,262
  • 9
  • 61
  • 97
  • is your question how to implement a finite state machine? or is your question how to implement the visualisation of a finite state machine ? – Vincent Briglia Feb 02 '13 at 19:53
  • http://code.google.com/p/canviz/ is a graphviz equivalent in javaScript – Vincent Briglia Feb 02 '13 at 20:02
  • Sorry, specifically looking for the implementation bit, which is why I had mentioned `Workflow.js`. – NT3RP Feb 03 '13 at 05:10
  • 1
    There's quite a few workflow libraries listed in this SO thread: http://stackoverflow.com/questions/10414849/workflow-engine-in-javascript – jevakallio Feb 03 '13 at 08:02
  • Thanks for the mention, but unfortunately, none of those libraries are based off of `Backbone.js`. Furthermore, they all appear to require that you set up the state machine upon initialization. – NT3RP Feb 03 '13 at 16:20
  • @NT3RP, FSM is a quite general (and generalizable) tool. What specific Backbone integration are you looking for, that you cannot achieve with a non-Backbone solution and some glue code? Regarding generating the states dynamically, I don't think I've ever heard of a FSM solution that does that. How about some Functional Reactive Programming instead, for setting up a state machine with bacon.js: https://github.com/raimohanska/bacon.js ? – jevakallio Feb 03 '13 at 21:49
  • I'm not specifically looking for a finite state machine solution, more of a generic graph based one. – NT3RP Feb 04 '13 at 00:21

0 Answers0