473,909 Members | 6,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Digraph Class

I was thinking of implemented a class that would let you build a an
arbitrary class and was wondering if this as already been done before(I
assume it has, but just wondering).

The basic idea that I'm thinking of is to include a list of pointers to
classes that are the in's and the classes that are outs with a class type
for each edge(which can represent the "edges" value).

Basicaly, call it a node, the node contains a list of pointers to edges. An
edge is a class that points to a the edges "value"(a class type) and the end
of the edge with a direction flag.

After all that then I was thinking to develop some algorithms to
combine/remove nodes and do some computation(fin d shortest path, etc...).
Ofcourse, I have to worry about cycles and possibly long computational time,
but no big deal at the moment.

Anyways, anyone have any ideas for this? Maybe how I can do this more
efficently and also the most general? my idea right now is basicaly have two
classes node and edge with the node class containing a pointer to a list of
pointers of edges. I'm not sure what I will need to make being able to
compute things the most general though. Like say I have a digraph where each
node represents a part of a string... I need some general algorithms that
will work find if they were numbers(such as probabilities), but not sure if
the node is something more general. What I'm thinking is basically one
would extend the node class to override some computational functions so it
will still work, but I'm then I think that I'm still limiting the
possibilities.

What I want to do is make is the most general it can be, as I've said... so
you could have different "types" of nodes and different "types" of edges.
Like some nodes could be people and others are numbers. Its up to the person
who implements the class to specify how nodes interact through the edges. I
guess what I'm thinking of doing is having the user override the arithmetic
operators and using those to implement things such as shortest path, etc...
(gotta read over some graph there first I suppose).
any ideas?
Jon
Jul 23 '05 #1
2 2010
"Jon Slaughter" <Jo***********@ Hotmail.com> wrote...
I was thinking of implemented a class [...]
any ideas?


Have you seen GTL (Graph Template Library)? Or Boost Graph Library?
Jul 23 '05 #2

"Victor Bazarov" <v.********@com Acast.net> wrote in message
news:V5******** ************@co mcast.com...
"Jon Slaughter" <Jo***********@ Hotmail.com> wrote...
I was thinking of implemented a class [...]
any ideas?


Have you seen GTL (Graph Template Library)? Or Boost Graph Library?

I haven't, I will search for them.

Thanks.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10969
by: Murat Tasan | last post by:
hi, i am having a small problem with constructing an inner class. i am using an inner class (and not a static nested class) because the methods of the inner class need access to the enclosing object's members. now, i have an enclosing class, which has a static factory method (loads an instance of the enclosing class from a serialized file, and returns it). during the loading, some initialization takes place. one of the initialization...
2
9608
by: Fernando Rodriguez | last post by:
Hi, I need to traverse the methods defined in a class and its superclasses. This is the code I'm using: # An instance of class B should be able to check all the methods defined in B #and A, while an instance of class C should be able to check all methods #defined in C, B and A. #------------------------------------------------
2
2045
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a Base class (old-style) which defines a default class attribute 'bar' too. I can't modify the source code of this class. Note that Workes does not inherit from Base. - a Derived class which must inherit from Base and is a wrapper around Worker: it...
1
3350
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me to turn a previously made String class that deals with char's into a templated String class that uses the template parameter C instead of char. I thought it would be fairly simple to do this exercise, but I encoutered many errors for my...
9
5007
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class pointer which points to an instance of a derived class, but when I pass that base class pointer into a function, it can't access the derived object's public functions. Although, the base class pointer does call the appropriate virtual function...
5
3169
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits CommonPageBase - Contains myPage which inherits PageBase Each of these classes overrides OnInit and ties an event handler
1
5397
by: MakaMaka | last post by:
Hi, Does anybody know of a good widget for wxpython, gtk, etc. that allows the editing of block diagrams and make it easy to export the diagram as a digraph? It has to be available under Windows. I want the user to draw a series of blocks on a canvas, connect them with directional arrows, and then a function will extract the digraph this represents and do some graph traversal algorithms on it. Think DIA or VISIO w/ only a few blocks...
3
3765
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and thawed it out. I built a console app using Microsoft Visual C++ 6 (VC++) and it worked great. Only one line in the header file had to be commented out. I built a console app using Borland C++ Builder 5. The linker complained of references to...
0
2849
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass magic, I wrote the following module. It is mainly useful as a light weight tool to help programmers catch mistakes at definition time (e.g., forgetting to implement a method required by the given interface). This is handy when unit tests or...
0
10037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9879
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11348
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11052
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10540
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7249
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.