Results 1 to 1 of 1

Thread: Design Challenge: Graphs

Threaded View

  1. #1

    Thread Starter
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Design Challenge: Graphs

    Those of us who have been around the programming community will have already used the composite design pattern to model hierarchies.

    Some of you will also know that a tree is an acyclic directed graph.

    So here's the challenge: come up with a design pattern that can implement a part hierarchy, and/or a general graph (with or without cycles - so tree's can be modelled as well) The design pattern should be based on abstract classes (aka interfaces) You can't use a composite pattern because the connections between the vertices can (potentially) be weighted (unlike a tree) A primer on graphs can be found here (which also contains excellent pointers to reference material for procedural representation)

    This is an area which can easily be modelled using procedural programming, but becomes harder when the programming model restricts the uses of cycles. (ie OO vs procedural)

    Is it just an academic exercise? No! Neural nets, for example, are an implementation of a digraph.

    We can all declare an interface which implements a class that encapulates an adjacency matrix and publishes methods against the adjacency matrix - but then that's not a design pattern.

    One last criterium . . . it needs to be fast.

    (and I'm not at college and this isn't my homework)
    Last edited by yrwyddfa; Apr 23rd, 2006 at 10:33 AM.
    "As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein

    It's turtles! And it's all the way down

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width