If you ignore the identity mappings (which all technically create trivial loops), these mappings would form a directed acyclic graph (DAG). I would look at some of the graph libraries, e.g. fgl, to see if they have anything appropriate.
John > From: G?nther Schmidt <[email protected]> > Hi list, > > the problem I have stems from the app I had developed. What my app does > is to split the money a hospital receives for a case to the departments > involved in a fair way. > > An additional requirement however was to allow the users of the app to > re-map any revenue shares credited to certain departments to other > departments. Such cases are sometimes due to politics within the > hospital and also have more legitimate reasons, like saying the > radiology should not receive shares for surgical procedures but those > shares should be redirected to the "General surgery" department. > > The feature is already implemented, but I'm not pleased with it, > especially since I did not develop a mathematical model for it. > > Details: > > It boils down to model mappings, or rather what sort of data structure > would be suited for this kind of thing. > > Dept A is "mapped" to itself > A -> A > > Dept B is mapped to Dept C > B -> C > > Dept C is mapped to Dept C > C -> C > > Dept D is mapped to Dept A > D -> A > > It should not be possible to construct looping mappings, ie. > > 1. A -> B > 2. B -> C > 3. C -> A > > ...... > > > What sort of model would be suitable to describe this, some sort of matrix? > > Günther _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
