Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7416055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:24:54+00:00 2026-05-29T07:24:54+00:00

I am doing a project on Graph Theory and am implementing some graph algorithms.

  • 0

I am doing a project on Graph Theory and am implementing some graph algorithms.

I would like to separate

  • the Algorithm’s code (such as BFS,DFS…),
  • the Graph handling code(such as Graph class itself, Edges and vertices handling..etc), and
  • the GUI related code

I have 2 questions related to the design of the application:

  1. Should I use a separate package for each? Also, anything anyone can add about connecting and making those parts co-operate would be helpful.

  2. What design pattern should I use for the Algorithms code? Should it be a static class, a singleton, or any other suggestion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:24:54+00:00Added an answer on May 29, 2026 at 7:24 am

    There is no general answer. The decision depends on whether and how you are planning on reusing the system you are developping.

    As you specified, using well known design patters is a good idea. I don’t know your architectural goals, but I can recommend the following general guidelines:

    Design the “model” (data structure) in its own package. This layer should only include “model”, and “state” representation of your system: graph, vertex, orientation, weights, etc. This layer most likely should also contain model maintenance logic (Add a node to the graph, get nodes, get vertex, create vertices, add weight, etc) Take a look at the structural patterns (Composite, Facade, etc) and see if any of them could be applied to your model.

    Implement the algorithms in a separate layer. Most of the time, making these components “stateless” is a good idea (static functions performing operations on the model). Take a look at the behavioral patterns (Visitor, Chain of Responsibility, Iterator, Interpreter, Command, etc. ), and see if any of them could be applied.

    Use the Observer design pattern to design your “rendering” (displaying, visualizing) layer. This pattern allows you to decouple the observed(model) and the view, and eventually provide several types of views for the same model.

    As I said, there is no general solutions. These are just some ideas with the goal of implementing decoupled and easily maintainable and reusable software.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some integration with Facebook on a project (using graph api) and everything
I'm doing a project that involves solving some NP-hard graph problems. Specifically triangulation of
I m doing project in opencv... i m getting error like this Unhandled exception
I am doing a mini project and i am stuck with a code. My
Currently I have the following code for a project that represents some probability trees
I'm doing my final project for my algorithms course in C. For the project,
I have a project where I'm implementing Dijkstra's shortest path algorithm using C++ classes.
Currently am doing project on Family Business. In that I need some video calling
I am doing project in php.I used ajax code to upload the image. It
I am doing project euler question 33 and have divised a refactor to solve

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.