1
/**************************************************************/
2
/* ********************************************************** */
6
/* * $Module: GRAPH * */
8
/* * Copyright (C) 1998, 2001 MPI fuer Informatik * */
10
/* * This program is free software; you can redistribute * */
11
/* * it and/or modify it under the terms of the FreeBSD * */
14
/* * This program is distributed in the hope that it will * */
15
/* * be useful, but WITHOUT ANY WARRANTY; without even * */
16
/* * the implied warranty of MERCHANTABILITY or FITNESS * */
17
/* * FOR A PARTICULAR PURPOSE. See the LICENCE file * */
18
/* * for more details. * */
21
/* $Revision: 1.2 $ * */
23
/* $Date: 2010-02-22 14:09:58 $ * */
24
/* $Author: weidenb $ * */
27
/* * Christoph Weidenbach * */
28
/* * MPI fuer Informatik * */
29
/* * Stuhlsatzenhausweg 85 * */
30
/* * 66123 Saarbruecken * */
31
/* * Email: spass@mpi-inf.mpg.de * */
34
/* ********************************************************** */
35
/**************************************************************/
38
/* $RCSfile: graph.h,v $ */
48
int comp_num; /* completion number */
49
POINTER info; /* user defined information */
51
} GRAPHNODE_STRUCT, *GRAPHNODE;
54
NAT size; /* number of nodes */
55
LIST nodes; /* list of GRAPHNODES */
56
NAT dfscount; /* used for DFS */
57
NAT compcount; /* used for DFS */
58
} GRAPH_STRUCT, *GRAPH;
60
static __inline__ NAT graph_NodeNumber(GRAPHNODE Node)
65
static __inline__ int graph_NodeDfsNum(GRAPHNODE Node)
70
static __inline__ void graph_NodeSetDfsNum(GRAPHNODE Node, int Number)
72
Node->dfs_num = Number;
75
static __inline__ int graph_NodeCompNum(GRAPHNODE Node)
77
return Node->comp_num;
80
static __inline__ void graph_NodeSetCompNum(GRAPHNODE Node, int Number)
82
Node->comp_num = Number;
85
static __inline__ LIST graph_NodeNeighbors(GRAPHNODE Node)
87
return Node->neighbors;
90
static __inline__ POINTER graph_NodeInfo(GRAPHNODE Node)
95
static __inline__ void graph_NodeSetInfo(GRAPHNODE Node, POINTER Info)
100
static __inline__ NAT graph_NodeOutdegree(GRAPHNODE Node)
102
return list_Length(graph_NodeNeighbors(Node));
105
static __inline__ BOOL graph_NodeVisited(GRAPHNODE Node)
107
return graph_NodeDfsNum(Node) >= 0;
110
static __inline__ BOOL graph_NodeCompleted(GRAPHNODE Node)
112
return graph_NodeCompNum(Node) >= 0;
115
static __inline__ NAT graph_Size(GRAPH Graph)
120
static __inline__ LIST graph_Nodes(GRAPH Graph)
125
GRAPH graph_Create(void);
126
void graph_Delete(GRAPH);
128
GRAPHNODE graph_GetNode(GRAPH, NAT);
129
GRAPHNODE graph_AddNode(GRAPH, NAT);
131
void graph_AddEdge(GRAPHNODE, GRAPHNODE);
132
void graph_DeleteEdge(GRAPHNODE, GRAPHNODE);
133
void graph_DeleteDuplicateEdges(GRAPH);
135
void graph_SortNodes(GRAPH, BOOL (*)(GRAPHNODE, GRAPHNODE));
136
NAT graph_StronglyConnectedComponents(GRAPH);
138
void graph_NodePrint(GRAPHNODE Node);
139
void graph_Print(GRAPH);