[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Three new functions: a help

**From**: |
giandomenico . sica |

**Subject**: |
Three new functions: a help |

**Date**: |
Thu, 22 Jun 2006 12:41:48 +0200 |

**User-agent**: |
Internet Messaging Program (IMP) H3 (4.0.3) |

Hello,
I've the following code...
ELEMENTS = ['one' 'number' 'a' 'letter']
COMBINATIONS = []
ASSOCIATIONS = ['a' 'b'; 'a' 'c'; 'a' 'd'; 'a' 'e']
And would like to define three new functions.
1) countassociations(a,...;b,...)
2) drawgraph
3) drawgraph(a, ..., ...)
1. countassociations(a,...;b,...)
"countassociations(a,...,...;c,...,...)" function, given the strings
"a", "..." and "c", "...", should answer the following question:
how many rows in "associations" include the string "a", excluding the rows
that include also the string "c"?
Example
By writing "countassociations(a,e,f;c,d,q)" it should
count how many rows include the string "a" or "e" or "f", excluding the rows
that include also the string "c" or "d" or "q".
2. drawgraph
"drawgraph" function should execute the following command:
draw a multigraph (graph in the sense of graph theory) where all the rows
included in COMBINATIONS are represented through nodes linked through normal
lines and all the rows ASSOCIATIONS are represented through nodes linked
through dotted lines.
Example
To represent "a" "b" in COMBINATIONS we have a node for "a", a node for "b"
and a normal line linking the two nodes.
To represent "a" "b" in ASSOCIATIONS we have a node for "a", a node for "b"
and a dotted line linking the two nodes.
Thus, the node "a" will be linked to "b" through two kinds of lines: one
normal line and one dotted line.
3. drawgraph(a,...,...)
"drawgraph(a,...,...)" function is similar to "drawgraph" with one
difference.
"drawgraph" draws a graph representing all the rows included in COMBINATIONS
and ASSOCIATIONS.
"drawgraph(a,...,...)" draws a graph representing all the rows included in
COMBINATIONS and ASSOCIATIONS which contain the string "a", the string "..."
and so on.
Can you help me please to define these three functions?
Really many thanks for the support.
Best,
Nico