[digraphanalysis-cvs] digraphanalysis/src/digraph_analyze main.c,
Status: Planning
Brought to you by:
jbreker
|
From: Jeff B. <jb...@us...> - 2005-09-18 03:08:40
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src/digraph_analyze In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2648/digraph_analyze Modified Files: main.c Log Message: implement some parts Index: main.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/digraph_analyze/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.c 17 Sep 2005 22:53:46 -0000 1.1 --- main.c 18 Sep 2005 03:08:32 -0000 1.2 *************** *** 34,38 **** struct graph *analyze_msd(struct graph *graph) { ! struct graph *graph_msd = NULL; return graph_msd; --- 34,47 ---- struct graph *analyze_msd(struct graph *graph) { ! struct graph *graph_msd = NULL; ! struct listlink *node_link = NULL; ! ! graph_msd = graph_new(graph->alias_list, list_new(node_compare_msd, node_print)); ! ! LIST_FOREACH(node_link, graph->node_list, list) ! { ! node_msd(node_link->object, graph->node_list); ! graph_add_node(graph_msd, node_link->object); ! } return graph_msd; *************** *** 43,51 **** struct list *analyze_subgraphs(struct graph *graph_msd) { ! struct list *subgraphs; ! if((subgraphs = list_new()) == NULL) ! err(EX_UNAVAILABLE, "list_new() == NULL"); return subgraphs; } --- 52,78 ---- struct list *analyze_subgraphs(struct graph *graph_msd) { ! struct graph *graph; ! struct listlink *graph_link; ! struct node *node; ! struct listlink *node_link; ! struct list *subgraphs; ! if((subgraphs = list_new(graph_compare, graph_print)) == NULL) ! err(EX_UNAVAILABLE, "list_new(graph_compare, graph_print) == NULL"); + LIST_FOREACH(node_link, graph_msd->node_list, list) + { + LIST_FOREACH(graph_link, subgraphs, list) + if((node = graph_find_node(graph_link->object, node_link->object)) != NULL) + break; + if(node == NULL) + { + graph = graph_new(graph_msd->alias_list, list_new(node_compare_msd, node_print)); + graph_add_node(graph, node_link->object); + /* todo: Add strongly connected links */ + list_add(subgraphs, graph); + } + } + return subgraphs; } |