Sponsored Content
Full Discussion: [C] deleting node from graph
Top Forums Programming [C] deleting node from graph Post 302531916 by Loic Domaigne on Saturday 18th of June 2011 03:15:14 PM
Old 06-18-2011
Hi Luke,

Quote:
Fact is, sometimes it crashes: could you help me understand why?
I didn't spend much time with your program, but it occured to me that these lines look rather suspicious:
Code:
 
for( i = u; i < G->nv; i++ )
    if( i + 1 < G->nv ) G->adj[i] = G->adj[i+1];
free(G->adj[i]);

Are you not supposed to free G->adj[u] first, and then perform the shifting G->adj[i-1] = G->adj[i] for i=u+1 to G->nv ?

Quote:
And is this a good implementation, or could I do better?
Is your graph directed, or undirected? What are the operations on the graph you want to be most efficient?

Cheers, Loïc
This User Gave Thanks to Loic Domaigne For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Graph generation

How can I generate graphs using perl in unix solaris environment? Please suggest. (2 Replies)
Discussion started by: wadhwa.pooja
2 Replies

2. AIX

Performance graph

Guru's I need to develop a graph which shows the CPU, memory and swap space utilization in a single graph against time I know of NMON but I am not able to make a single graph out of it. Does anyone know of any script or tool for data sampling and developing graph? Thanks in advance ... (1 Reply)
Discussion started by: balaji_prk
1 Replies

3. Shell Programming and Scripting

FS Growth Graph

It's been a while since i've been here.. and hopefully you can help me. I have created a script to get the filesystem utilization. Now i want to create a growth graph, which would show how much kb we increase per day. Here's the data 03-02-2010 00:00:00: /dev/md/dsk/d30 46473377 7355320... (5 Replies)
Discussion started by: ryandegreat25
5 Replies

4. Solaris

SVM metaset on 2 node Solaris cluster storage replicated to non-clustered Solaris node

Hi, Is it possible to have a Solaris cluster of 2 nodes at SITE-A using SVM and creating metaset using say 2 LUNs (on SAN). Then replicating these 2 LUNs to remote site SITE-B via storage based replication and then using these LUNs by importing them as a metaset on a server at SITE-B which is... (0 Replies)
Discussion started by: dn2011
0 Replies

5. UNIX for Dummies Questions & Answers

Help with Plotting a graph using Perl

Dear all, I have a hash in my data file and I'd like to output the data contained within as a graph (can be lines or histogram form) but I dont know how to do this with Perl. Can somone suggest how I can have a graph with Keys of the hash being on the X-axis and the Values for the keys plotted on... (1 Reply)
Discussion started by: pawannoel
1 Replies

6. Programming

Graph in java

Hello, Please how can represent this graph in java ? i have to apply an algorithm on this graphe, the first instruction of the algorithm is to verify if the three last vertices are dependent or not ? Thank you. (1 Reply)
Discussion started by: chercheur857
1 Replies

7. UNIX for Dummies Questions & Answers

Deleting a pattern in UNIX without deleting the entire line

Hi I have a file: r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e) I want to retain... (15 Replies)
Discussion started by: Alyaa
15 Replies

8. Homework & Coursework Questions

Accessing one UNIX node from another node of the same server

Hi Experts, I am in need of running a script from one node say node 1 via node 2. My scheduling tool dont have access to node2 , so i need to invoke the list file from node1 but the script needs to run from node2. because the server to which i am hitting, is having access only for the node... (5 Replies)
Discussion started by: arun1377
5 Replies

9. HP-UX

Mount FIle systems from node-1 onto node-2

Hi, We have HP UX service guard cluster on OS 11.23. Recently 40+ LUNs presented to both nodes by SAN team but I was asked to mount them on only one node. I created required VGs/LVs, created VxFS and mounted all of them and they are working fine. Now client requested those FS on 2nd node as... (4 Replies)
Discussion started by: prvnrk
4 Replies
GENDERS_TESTATTR(3)						    LIBGENDERS						       GENDERS_TESTATTR(3)

NAME
genders_testattr - test if a node has an attribute SYNOPSIS
#include <genders.h> int genders_testattr(genders_t handle, const char *node, const char *attr, char *val, int len); int genders_testattrval(genders_t handle, const char *node, const char *attr, const char *val); DESCRIPTION
genders_testattr() tests if the node pointed to by node contains the attribute pointed to by attr. If node is NULL, the current node is tested. If the attribute is found, its value is stored in the buffer pointed to by val. len should indicate the length of the buffer. If the attribute value is not needed, val can be set to NULL. To avoid passing in an attribute value buffer that is not large enough to store the attribute value, genders_getmaxvallen(3) should be used to determine the minimum buffer size that should be used. genders_testattrval() tests if the node pointed to by node contains the attribute pointed to by attr and if that attribute is equal to the attribute value pointed to by val. If val is NULL, only the attribute is tested. RETURN VALUES
For genders_testattr(), if the node contains the attribute, 1 is returned. 0 is returned if the node does not contain the attribute. For genders_testattrval(), if the node contains the attribute and it is equal to the attribute value, 1 is returned. 0 is returned if the node does not contain the attribute, or if the attribute is not equal to the attribute value. For both genders_testattr() and genders_testattrval(), -1 is returned on error, and an error code is returned in handle. The error code can be retrieved via genders_errnum(3) , and a description of the error code can be retrieved via genders_strerror(3). Error codes are defined in genders.h. ERRORS
GENDERS_ERR_NULLHANDLE The handle parameter is NULL. The genders handle must be created with genders_handle_create(3). GENDERS_ERR_NOTLOADED genders_load_data(3) has not been called to load genders data. GENDERS_ERR_OVERFLOW The buffer pointed to by val is not large enough to store the attribute value. GENDERS_ERR_PARAMETERS An incorrect parameter has been passed in. GENDERS_ERR_NOTFOUND The node pointed to by node cannot be found in the genders file or if node=NULL, the machine genders is running on is not listed in the genders database. GENDERS_ERR_MAGIC handle has an incorrect magic number. handle does not point to a genders handle or handle has been destroyed by genders_han- dle_destroy(3). FILES
/usr/include/genders.h SEE ALSO
libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getmaxvallen(3), genders_errnum(3), genders_strerror(3) LLNL
August 2003 GENDERS_TESTATTR(3)
All times are GMT -4. The time now is 04:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy