"Séb" <[EMAIL PROTECTED]> writes:

> Hi everybody,
>
> Thanks for the time taken to answer my question. Unfortunatly, it seems
> that there's a little confusion about what I want to do.
>
> In fact, I don't want to search for a particular path between
> computers. What I really want is to detect sequences of connection that
> are repeated along the log. Is it clearer, if not, I will put another
> exmample ;-)

You're right - I was confused. That's why I asked about the timing
issue. But I also indicated that I might be way off base with that.

Everyone may be confused as well - we thought you were looking for
*any* series of connections that started at one computer and ended at
a second computer. That problem is the well-understood problem of
finding a path through a graph, where "path" is used in a
graph-theoretic sense and not a network sense.

>From what you say above, it looks like you're looking for a specfic
sequence of connections in your connetions record. That's a much
easier problem. Roughly, you'd do:

def matches(desired, history):
"""Determines if history contains the desired path.
    desired = # List of connections we're looking for.
    history = # List of connections that were actually made."""

    for con in desired:
        try:
            while not con.matches(history[hp]):
                hp += 1
        except IndexError:
            return False
   return True


   <mike
-- 
Mike Meyer <[EMAIL PROTECTED]>                  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to