[Haskell-beginners] How to represent a (running) network?

Martin Drautzburg Martin.Drautzburg at web.de
Mon Jan 14 21:51:29 CET 2013


Hello all,

I am trying to implement a discrete event siumulation for a logistic network. 
To do this, I need a representation of the network as such and a way to 
express what each Process does when it gets alerted by an event.

A Process has inputs and outputs which are again connected to outputs and 
inputs of other Processes. Establishing these connections constructs the 
network as such.

But the Processes also need to do something. They need to take something from 
one of their inputs, so something with it and place something on one of their 
outputs.

So I kind of have a dual usage for inputs and outputs: they play a role in the 
topology of the network and in the "function" which defines a process. How can 
I keep the two in sync? Is there a way prevent a Process from trying to use an 
output which does not exist?

What would be a good way to represent a Network anyways? I believe the classic 
approach is a list of nodes and a list vertices. In the simulation I will 
frequently have to find the process of an input or output and to find the 
input connected to an output. The node/vertices implementation seems to 
require scanning lists, which could be slow once I have thousands of 
processes.

Other than that any pointers to how to construct networks (which go beyond 
mere graphs) would be much appreciated.

-- 
Martin



More information about the Beginners mailing list