Update of /cvsroot/digraphanalysis/digraphanalysis/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3817
Modified Files:
graph.c node.c
Log Message:
implementing functions
Index: graph.c
===================================================================
RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/graph.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** graph.c 21 Apr 2005 18:44:42 -0000 1.2
--- graph.c 22 Apr 2005 01:55:21 -0000 1.3
***************
*** 22,25 ****
--- 22,31 ----
#include "node.h"
+ int
+ graph_compare(struct graph *graph1, struct graph *graph2)
+ {
+ return nodelist_compare(graph1->node_list, graph2->node_list);
+ }
+
struct graph *
graph_new(struct aliaslist *alias_list, struct nodelist *node_list)
***************
*** 39,42 ****
--- 45,76 ----
graphlist_add(struct graphlist *graph_list, struct graph *graph)
{
+ int i;
+ struct graphlink *graph_iter, *graph_link;
+
+ graph_link = (struct graphlink *) malloc(sizeof(struct graphlink));
+ graph_link->graph = graph;
+
+ if(LIST_EMPTY(graph_list))
+ LIST_INSERT_HEAD(graph_list, graph_link, list);
+ else
+ LIST_FOREACH(graph_iter, graph_list, list)
+ {
+ if((i = graph_compare(graph, graph_iter->graph)) < 0)
+ {
+ if(graph_iter == LIST_FIRST(graph_list))
+ LIST_INSERT_HEAD(graph_list, graph_link, list);
+ else
+ LIST_INSERT_BEFORE(graph_iter, graph_link, list);
+ break;
+ }
+ else
+ if(i == 0)
+ return graph_iter->graph;
+ else
+ if(LIST_NEXT(graph_iter, list) == NULL)
+ LIST_INSERT_AFTER(graph_iter, graph_link, list);
+ }
+
+ return graph;
}
Index: node.c
===================================================================
RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** node.c 21 Apr 2005 18:44:42 -0000 1.4
--- node.c 22 Apr 2005 01:55:21 -0000 1.5
***************
*** 42,45 ****
--- 42,50 ----
}
+ int
+ nodelist_compare(struct nodelist *node_list1, struct nodelist *node_list2)
+ {
+ }
+
struct nodelist *
nodelist_duplicate(struct nodelist *node_list)
|