473,396 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

data structure for graph

Hello,

A data structure for the implementation of graph can be

struct node
{
int index;
struct node *next;
};

struct adjnode // node adjacent to node
{
int adjindex;
struct node *next;
struct adjnode *next;
};
input file is

node1 adjnode1 adjnode3
node2 adjnode1 adjnode4
node3 adjnode1 adjnode4
node3 adjnode2 adjnode3

such that 1234 forms a quadrilateral.

How can I populate all the data in one file read...
Kindly reply,
Regards,
Sameer.
Nov 13 '05 #1
4 9002

"Sameer" <ia*******@hotmail.com> wrote in message
news:bk************@ID-160782.news.uni-berlin.de...
Hello,

A data structure for the implementation of graph can be

struct node
{
int index;
struct node *next;
};

struct adjnode // node adjacent to node
{
int adjindex;
struct node *next;
struct adjnode *next;
};
input file is

node1 adjnode1 adjnode3
node2 adjnode1 adjnode4
node3 adjnode1 adjnode4
node3 adjnode2 adjnode3

such that 1234 forms a quadrilateral.

How can I populate all the data in one file read...
Kindly reply,
Regards,
Sameer.

sorry the currect input file is

node1 adjnode2 adjnode3
node2 adjnode1 adjnode4
node3 adjnode1 adjnode4
node4 adjnode2 adjnode3
Nov 13 '05 #2
Hi Sameer,
"Sameer" <ia*******@hotmail.com> wrote in message
news:bk************@ID-160782.news.uni-berlin.de...
....
| > A data structure for the implementation of graph can be
| >
| > struct node
| > {
| > int index;
| > struct node *next;
| > };
| >
| > struct adjnode // node adjacent to node
| > {
| > int adjindex;
| > struct node *next;
| > struct adjnode *next;
| > };
....
| sorry the currect input file is
|
| node1 adjnode2 adjnode3
| node2 adjnode1 adjnode4
| node3 adjnode1 adjnode4
| node4 adjnode2 adjnode3

Unfortunately, your question remains too vague.
There are many kinds of graphs (cyclic/acyclic,
oriented or not, ...), and even more ways
to represent them using different data structures.

From your post, I still do not understand how
struct node and struct adjnode are intended to
be used.

I think you need to tell more about your
goals/constraints/requirements.
Regards,
Ivan
--
http://ivan.vecerina.com
Nov 13 '05 #3

"Sameer" <ia*******@hotmail.com> wrote in message
A data structure for the implementation of graph can be

struct node
{
int index;
struct node *next;
};

struct adjnode // node adjacent to node
{
int adjindex;
struct node *next;
struct adjnode *next;
};
input file is

node1 adjnode1 adjnode3
node2 adjnode1 adjnode4
node3 adjnode1 adjnode4
node3 adjnode2 adjnode3

such that 1234 forms a quadrilateral.

How can I populate all the data in one file read...

If you're only allowed to make one call to a read function, the only thing
you can do is read to a temporary buffer. This doesn't really answer ypur
question.

It looks like each line starts with a terminal node, then contains an
arbitrary number of adjnodes that point to the terminal node, and to another
adjnode.
However what I don't understand is that you seem to have declared 8
adjnodes, yet the maximum index is four. Are you sure that adjnodes don't
actually contain two adjnode pointers?
Nov 13 '05 #4
On Mon, 15 Sep 2003 17:36:50 +0530, "Sameer" <ia*******@hotmail.com>
wrote:
Hello,

A data structure for the implementation of graph can be

struct node
{
int index;
struct node *next;
};

struct adjnode // node adjacent to node
{
int adjindex;
struct node *next;
struct adjnode *next;
};


There can be only one member named next is struct adjnode. Perhaps
you would like to call these two pointer n_next and a_next.

<<Remove the del for email>>
Nov 13 '05 #5

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

Similar topics

6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
5
by: clintonG | last post by:
I'm looking for documentation and would not turn my nose up to any code from anybody who thinks they are good at the design of an algorythm that can be used to generated a hierarchical relational...
5
by: Mike | last post by:
Hi, I'm new to vb.net and would be grateful if anyone could offer some advice on the best way to approach this problem: I wish to dynamically capture pricing information e.g. 10 stock prices...
2
by: Jonny | last post by:
Hi; I have a spice netlist contain capacitors, resistors, and mosfets. I want to store the componets in a graph so I can perform the following actions. 1. Check whether or not the network...
12
by: Nathan Harmston | last post by:
Hi All, Currently I am working on a generic graph library so I can do various graph based analysis for various projects I have ideas for. Currently I am implementing Graph as a wrapper around a...
12
by: estantep | last post by:
Hello, I am having some trouble trying to pass a pointer to an structure array (as function argument), when executing I get seg faults. The best I could get out from googling was: #define...
9
by: TDB | last post by:
Hello, I'm creating an application using C which requires the data structures like trees and graphs to be stored in files and retrieved later ( simply serialization of a data structure ) . Is...
2
by: jehugaleahsa | last post by:
Hello: I have a bunch of related items that are either parents, children or not directly related to each other. In my case, I have a bunch of database tables joined with foreign keys. Another...
5
by: amd321 | last post by:
i want ot make a site that represent graph data structure. and i know how to do it in c or c++ my qustion is 1.i can save my information in structure that i made myself in C ++, and represent it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...

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.