Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

graph.h File Reference

Main include file for the grgen C API. More...

#include <stdarg.h>
#include <gr/types.h>
#include <gr/set.h>
#include <gr/error.h>
#include <gr/dump.h>

Go to the source code of this file.

Defines

#define GR_MAGIC(a, b, c, d)   ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
#define gr_graph_get_backend(gr)   ((gr)->be)
#define gr_graph_get_model(gr)   ((gr)->model)
#define gr_get_data(type, gr)   ((type *) (gr)->data)

Typedefs

typedef struct struct struct
struct struct enum _gr_at_t 
gr_at_t
typedef _validate_info_t gr_validate_info_t
typedef void() gr_gen_listen_func_t (struct _gr_graph_t *graph, gr_id_t id, void *context)
typedef _gr_generic_listener_t gr_generic_listener_t
typedef enum _gr_listener_event_t gr_listener_event_t
typedef _gr_graph_t gr_graph_t
typedef enum _gr_init_flags_t gr_init_flags_t
typedef _gr_graph_model_t gr_graph_model_t

Enumerations

enum  gr_magics_t {
  GR_GRAPH_MAGIC = GR_MAGIC('g', 'r', 'a', 'p'), GR_GRAPH_MODEL_MAGIC = GR_MAGIC('g', 'm', 'd', 'l'), GR_BACKEND_MAGIC = GR_MAGIC('b', 'e', 'n', 'd'), GR_BACKEND_MODEL_MAGIC = GR_MAGIC('b', 'm', 'd', 'l'),
  GR_GENERATION_MAGIC = GR_MAGIC('g', 'e', 'n', 'e')
}
enum  _gr_at_t {
  GR_AT_INVALID = 0, GR_AT_INTEGER = 1, GR_AT_BOOLEAN = 2, GR_AT_STRING = 3,
  GR_AT_ENUM = 4
}
enum  _gr_listener_event_t {
  GR_LISTENER_ADD_NODE = 0, GR_LISTENER_ADD_EDGE = 1, GR_LISTENER_DEL_NODE = 2, GR_LISTENER_DEL_EDGE = 3,
  GR_LISTENER_SET_NODE_TYPE = 4, GR_LISTENER_DEL_EDGES = 5, GR_LISTENER_REDIR_INCOMING = 6, GR_LISTENER_REDIR_OUTGOING = 7,
  GR_LISTENER_MAX = 8
}
enum  _gr_init_flags_t { GR_INIT_CREATE = 1, GR_INIT_OPEN = 2 }

Functions

const char * gr_graph_get_name (const gr_graph_t *gr)
const gr_domain_tgr_get_domain (const gr_graph_t *gr)
void gr_graph_delete (gr_graph_t *g)
char * gr_get_status (gr_graph_t *gr, char *buf, int len)
_gr_actions_tgr_new_actions (gr_graph_t *gr, const struct _gr_actions_model_t *am)
void gr_get_node_type_ids (const gr_graph_t *gr, gr_set_t *set)
void gr_get_edge_type_ids (const gr_graph_t *gr, gr_set_t *set)
void gr_get_node_attr_ids (const gr_graph_t *gr, gr_set_t *set)
void gr_get_edge_attr_ids (const gr_graph_t *gr, gr_set_t *set)
void gr_get_all_nodes_instance_of (gr_graph_t *gr, gr_id_t type, gr_set_t *set)
gr_id_t gr_get_node_root_type (gr_graph_t *gr)
gr_id_t gr_get_edge_root_type (gr_graph_t *gr)
gr_id_t gr_add_node (gr_graph_t *g, gr_id_t nt)
gr_id_t gr_add_edge (gr_graph_t *g, gr_id_t et, gr_id_t src, gr_id_t tgt)
int gr_remove_node (gr_graph_t *gr, gr_id_t node)
int gr_remove_edge (gr_graph_t *gr, gr_id_t edge)
int gr_remove_edges_of_node (gr_graph_t *gr, gr_id_t node)
int gr_node_type_is_a (gr_graph_t *gr, gr_id_t nt1, gr_id_t nt2)
int gr_node_instanceof (gr_graph_t *gr, gr_id_t node, gr_id_t type)
int gr_edge_type_is_a (gr_graph_t *gr, gr_id_t et1, gr_id_t et2)
int gr_edge_instanceof (gr_graph_t *gr, gr_id_t edge, gr_id_t type)
gr_id_t gr_get_type_of_node (gr_graph_t *gr, gr_id_t node)
int gr_set_type_of_node (gr_graph_t *gr, gr_id_t node, gr_id_t type)
gr_id_t gr_get_type_of_edge (gr_graph_t *gr, gr_id_t edge)
void gr_get_node_attr (gr_graph_t *g, gr_id_t n, gr_id_t attr, gr_value_t *v)
void gr_get_edge_attr (gr_graph_t *g, gr_id_t e, gr_id_t attr, gr_value_t *v)
void gr_set_node_attr (gr_graph_t *g, gr_id_t n, gr_id_t attr, const gr_value_t *v)
void gr_set_edge_attr (gr_graph_t *g, gr_id_t e, gr_id_t attr, const gr_value_t *v)
void gr_get_outgoing (gr_graph_t *g, gr_id_t n, gr_id_t et, gr_set_t *s)
void gr_get_incoming (gr_graph_t *g, gr_id_t n, gr_id_t et, gr_set_t *s)
gr_id_t gr_get_source (gr_graph_t *g, gr_id_t e)
gr_id_t gr_get_target (gr_graph_t *g, gr_id_t e)
const char * gr_get_node_type_name (gr_graph_t *gr, gr_id_t nt)
const char * gr_get_edge_type_name (gr_graph_t *gr, gr_id_t et)
gr_id_t gr_get_node_type_id (gr_graph_t *gr, const char *type_name)
gr_id_t gr_get_edge_type_id (gr_graph_t *gr, const char *type_name)
const char * gr_get_node_attr_name (gr_graph_t *gr, gr_id_t na)
const char * gr_get_edge_attr_name (gr_graph_t *gr, gr_id_t ea)
gr_id_t gr_get_node_attr_id (gr_graph_t *gr, gr_id_t type_id, const char *attr_name)
gr_id_t gr_get_edge_attr_id (gr_graph_t *gr, gr_id_t type_id, const char *attr_name)
gr_id_t gr_get_owner_type_of_node_attr (gr_graph_t *gr, gr_id_t node_attr)
gr_id_t gr_get_owner_type_of_edge_attr (gr_graph_t *gr, gr_id_t edge_attr)
gr_at_t gr_get_node_attr_type_kind (gr_graph_t *gr, gr_id_t node_attr, gr_id_t *enum_type_id)
gr_at_t gr_get_edge_attr_type_kind (gr_graph_t *gr, gr_id_t edge_attr, gr_id_t *enum_type_id)
const char * gr_get_enum_type_name (gr_graph_t *gr, gr_id_t enum_id)
void gr_get_enum_members (gr_graph_t *gr, gr_id_t enum_type_id, gr_set_t *set)
gr_int_t gr_get_enum_member_value (gr_graph_t *gr, gr_id_t enum_id, gr_id_t enum_member_id)
const char * gr_get_enum_member_name (gr_graph_t *gr, gr_id_t enum_id, gr_id_t enum_member_id)
void gr_get_node_type_super_type (gr_graph_t *gr, gr_id_t type_id, gr_set_t *set)
void gr_get_edge_type_super_type (gr_graph_t *gr, gr_id_t type_id, gr_set_t *set)
void gr_dump (gr_graph_t *gr, gr_dump_t *gd)
_gr_actions_model_tgr_graph_load_actions_model (gr_graph_t *gr, const char *filename)
int gr_alloc_temp_ids (gr_graph_t *gr, gr_id_t *temp, int count)
void * gr_graph_add_listener (gr_graph_t *gr, gr_listener_event_t event, gr_gen_listen_func_t *func, void *context)
void gr_graph_remove_listener (gr_graph_t *gr, void *listener_ID)
int gr_graph_custom (gr_graph_t *gr, const char *which,...)
int gr_graph_validate (gr_graph_t *gr, int strict)
void gr_graph_mature (gr_graph_t *gr)
gr_id_t gr_get_edge_type_super_type_old (gr_graph_t *gr, gr_id_t type_id)
gr_id_t gr_get_node_type_super_type_old (gr_graph_t *gr, gr_id_t type_id)
gr_graph_tgr_clone (gr_graph_t *gr, const char *name)


Detailed Description

Main include file for the grgen C API.

Date:
2.9.2003
Author:
Sebastian Hack
Id
graph.h,v 1.36 2005/10/10 14:16:44 rubino Exp

Definition in file graph.h.


Define Documentation

#define gr_get_data type,
gr   )     ((type *) (gr)->data)
 

A macro to elegantly obtain the private data pointer from a graph.

Parameters:
type The type to cast the data pointer to.
gr The graph.

Definition at line 270 of file graph.h.

#define gr_graph_get_backend gr   )     ((gr)->be)
 

Get the backend of a graph.

Parameters:
gr The graph.
Returns:
The backend.

Definition at line 138 of file graph.h.

#define gr_graph_get_model gr   )     ((gr)->model)
 

Get the model of a graph.

Parameters:
gr A graph.
Returns:
The model.

Definition at line 145 of file graph.h.

#define GR_MAGIC a,
b,
c,
 )     ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
 

Definition at line 46 of file graph.h.


Typedef Documentation

typedef struct struct struct struct struct struct enum _gr_at_t gr_at_t
 

The available attribute type kinds.

typedef void() gr_gen_listen_func_t(struct _gr_graph_t *graph, gr_id_t id, void *context)
 

Generic Graph listener for changed ID's

Definition at line 92 of file graph.h.

typedef struct _gr_generic_listener_t gr_generic_listener_t
 

The generic listener struct.

typedef struct _gr_graph_model_t gr_graph_model_t
 

The Graph model, which different grgen backends must implement.

typedef struct _gr_graph_t gr_graph_t
 

The graph instance.

typedef enum _gr_init_flags_t gr_init_flags_t
 

Additional flags for model::init.

typedef enum _gr_listener_event_t gr_listener_event_t
 

Possible listener events for generic listener

typedef struct _validate_info_t gr_validate_info_t
 

The Validate Statements


Enumeration Type Documentation

enum _gr_at_t
 

The available attribute type kinds.

Enumeration values:
GR_AT_INVALID  invalid value
GR_AT_INTEGER  an integer
GR_AT_BOOLEAN  a boolean
GR_AT_STRING  a string
GR_AT_ENUM  an enumeration type

Definition at line 66 of file graph.h.

enum _gr_init_flags_t
 

Additional flags for model::init.

Enumeration values:
GR_INIT_CREATE  create new graph, delete of exists
GR_INIT_OPEN  opens graph

Definition at line 150 of file graph.h.

enum _gr_listener_event_t
 

Possible listener events for generic listener

Enumeration values:
GR_LISTENER_ADD_NODE  after a new node was added, reports the node ID
GR_LISTENER_ADD_EDGE  after a new edge was added, reports the edge ID
GR_LISTENER_DEL_NODE  before a node is deleted, reports the node ID
GR_LISTENER_DEL_EDGE  before an edge is deleted, reports the edge ID
GR_LISTENER_SET_NODE_TYPE  after a node gets a new type, reports the node ID
GR_LISTENER_DEL_EDGES  before all edges of a node are removed, reports node ID
GR_LISTENER_REDIR_INCOMING  before incoming edges are redirected, reports node ID
GR_LISTENER_REDIR_OUTGOING  before outgoing edges are redirected, reports node ID
GR_LISTENER_MAX 

Definition at line 107 of file graph.h.

enum gr_magics_t
 

Enumeration values:
GR_GRAPH_MAGIC 
GR_GRAPH_MODEL_MAGIC 
GR_BACKEND_MAGIC 
GR_BACKEND_MODEL_MAGIC 
GR_GENERATION_MAGIC 

Definition at line 48 of file graph.h.


Function Documentation

gr_id_t gr_add_edge gr_graph_t g,
gr_id_t  et,
gr_id_t  src,
gr_id_t  tgt
 

Add an edge to the graph.

Parameters:
g The graph.
et The type of the edge.
src The ID of the source node of the edge.
tgt The ID of the target node of the edge.

Definition at line 216 of file graph.c.

References ASSERT_FKT, ASSERT_GR, ASSERT_MODEL, GR_LISTENER_ADD_EDGE, and run_graph_listener().

Referenced by cm_add_edge(), and gr_copy_edges().

gr_id_t gr_add_node gr_graph_t g,
gr_id_t  nt
 

Add a node to the graph.

Parameters:
g The graph.
nt The type of the node.
Returns:
The ID of the inserted node.

Definition at line 201 of file graph.c.

References ASSERT_FKT, ASSERT_GR, ASSERT_MODEL, GR_LISTENER_ADD_NODE, and run_graph_listener().

Referenced by add_nodes(), cm_add_node(), and gr_copy_nodes().

int gr_alloc_temp_ids gr_graph_t gr,
gr_id_t temp,
int  count
 

Allocate temporary ID's. These ID's are only valid until the next operation that may change the graph. This function should only be used by dumpers that need to insert virtual nodes.

Parameters:
gr The graph.
temp An array that will take the temporary ID's.
count The number of ID's to be allocated, temp must be t least of this lenght.
Returns:
number of allocated ID's.

Definition at line 561 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_alloc_temp_ids(), and gr_dump_match().

gr_graph_t* gr_clone gr_graph_t gr,
const char *  name
 

Duplicates a graph. The new graph will use the same model and backend as the other.

Parameters:
gr The graph.
name Name of the graph.
Returns:
A new graph with the same structure as the other.

Definition at line 1460 of file graph.c.

References ASSERT_FKT, ASSERT_GR, ASSERT_MODEL, _gr_graph_model_t::clone, and _gr_graph_t::model.

void gr_dump gr_graph_t gr,
gr_dump_t gd
 

Dump the graph with a graph dumper.

Parameters:
gr The graph.
gd The graph dumper.

Definition at line 1365 of file graph.c.

References gr_dump_match().

Referenced by vcg_dump().

int gr_edge_instanceof gr_graph_t gr,
gr_id_t  edge,
gr_id_t  type
 

Check, if an edge is an instance of a given edge type.

Parameters:
gr The graph.
edge The edge type to check for.
type The other edge type.
Returns:
1, if edge is an instance of type.

Definition at line 131 of file graph.c.

References gr_edge_type_is_a(), and gr_get_type_of_edge().

int gr_edge_type_is_a gr_graph_t gr,
gr_id_t  et1,
gr_id_t  et2
 

Check, if an edge type is compatible to another node type.

Parameters:
gr The graph.
et1 The edge type to check for.
et2 The other edge type.
Returns:
1, if nt1 is compatible to nt2.

Definition at line 119 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_edge_type_is_a(), edge_attrs_conf_factory(), gr_dump_edge_attr(), and gr_edge_instanceof().

void gr_get_all_nodes_instance_of gr_graph_t gr,
gr_id_t  type,
gr_set_t set
 

Get all nodes in the graph, that are instance of a certain node type.

Parameters:
gr The graph.
type The node type, the nodes must be instance of.
set The set to put the nodes into.
Note:
The set is not cleared in advance.

Definition at line 174 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by check_incoming(), check_outgoing(), cm_get_all_nodes_instance_of(), dump_groups(), get_all_edges(), gr_dump_match(), and gr_get_all_nodes().

const gr_domain_t* gr_get_domain const gr_graph_t gr  ) 
 

Get the error reporting domain from a graph.

Parameters:
gr The graph.
Returns:
The domain.

Definition at line 94 of file graph.c.

References ASSERT_GR.

void gr_get_edge_attr gr_graph_t g,
gr_id_t  e,
gr_id_t  attr,
gr_value_t v
 

Get an attribute's value of an edge.

Parameters:
g The graph.
e The ID of the edge.
attr The ID of the attribute.
v A pointer to a value, where the attribute's is filled in.

Definition at line 306 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_attr(), edge_attrs_conf_factory(), and gr_dump_edge_attr().

gr_id_t gr_get_edge_attr_id gr_graph_t gr,
gr_id_t  type_id,
const char *  attr_name
 

Get the ID of an edge type attribute type with a given attribute name.

Parameters:
gr The graph.
type_id The ID of the type, which contains the attribute.
attr_name The name of the attribute.
Returns:
The ID of the attribute, or an invalid ID, if the attribute name is not available in the graph.

Definition at line 437 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_attr_id().

void gr_get_edge_attr_ids const gr_graph_t gr,
gr_set_t set
 

Get the set of valid edge attribute ids.

Parameters:
gr The graph.
set The set to them into.

Definition at line 165 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_attr_ids(), edge_attrs_conf_factory(), and gr_dump_edge_attr().

const char* gr_get_edge_attr_name gr_graph_t gr,
gr_id_t  ea
 

Get the name of an edge attribute.

Parameters:
gr The graph.
ea The edge attribute ID.
Returns:
The name of the attribute or NULL if an invalid attribute ID was passed.

Definition at line 418 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_attr_name(), edge_attrs_conf_factory(), and gr_dump_edge_attr().

gr_at_t gr_get_edge_attr_type_kind gr_graph_t gr,
gr_id_t  edge_attr,
gr_id_t enum_type_id
 

Get the type kind of an edge attribute.

Parameters:
gr The graph.
edge_attr The edge attribute.
enum_type_id If it's a enum type contains the enum type id here.
Returns:
The type kind of the node attribute.

Definition at line 474 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_attr_type_kind(), and gr_dump_edge_attr().

gr_id_t gr_get_edge_root_type gr_graph_t gr  ) 
 

Get the edge root type (called Edge).

Parameters:
gr The graph.
Returns:
The edge type ID for the root type.

Definition at line 192 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_root_type(), get_all_edges(), gr_dump_match(), and gr_get_outgoing_edges().

gr_id_t gr_get_edge_type_id gr_graph_t gr,
const char *  type_name
 

Get the ID of a edge type with a given type name.

Parameters:
gr The graph.
type_name The name of the type.
Returns:
The ID of the type, or an invalid ID, if the type name is not available in the graph.

Definition at line 400 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_type_id().

void gr_get_edge_type_ids const gr_graph_t gr,
gr_set_t set
 

Get the set of valid edge type ids.

Parameters:
gr The graph.
set The set to them into.

Definition at line 147 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_type_ids().

const char* gr_get_edge_type_name gr_graph_t gr,
gr_id_t  et
 

Get the name of an edge type.

Parameters:
gr The graph.
et The edge type ID.
Returns:
The name of the edge type, NULL if an invalid edge type ID was given.

Definition at line 382 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_type_name(), gr_dump_edge_attr(), gr_edge_label(), print_edges_error(), and validate().

void gr_get_edge_type_super_type gr_graph_t gr,
gr_id_t  type_id,
gr_set_t set
 

Get the type id of the direct super type of a edge type.

Parameters:
gr The graph.
type_id Edge type ID.
set after successful call contains the set of super types

Definition at line 545 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_edge_type_super_type().

gr_id_t gr_get_edge_type_super_type_old gr_graph_t gr,
gr_id_t  type_id
 

Definition at line 554 of file graph.c.

References gr_id_invalid.

const char* gr_get_enum_member_name gr_graph_t gr,
gr_id_t  enum_id,
gr_id_t  enum_member_id
 

Get the name of an enum member.

Parameters:
gr The graph.
enum_id The id of the enum type.
enum_member_id The ID of the member.
Returns:
The name of the enum member.
Note:
Use gr_get_enum_members() to get all valid enum member IDs.

Definition at line 511 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_enum_member_name().

gr_int_t gr_get_enum_member_value gr_graph_t gr,
gr_id_t  enum_id,
gr_id_t  enum_member_id
 

Get the value of an enum member.

Parameters:
gr The graph.
enum_id The id of the enum type.
enum_member_id The ID of the member.
Returns:
The integer value of the enum member.
Note:
Use gr_get_enum_members() to get all valid enum member IDs.

Definition at line 501 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_enum_member_value().

void gr_get_enum_members gr_graph_t gr,
gr_id_t  enum_type_id,
gr_set_t set
 

Get all valid member ids for an enum type.

Parameters:
gr The graph.
enum_type_id The enum type id.
set A set where all valid enum member ids are put into.

Definition at line 492 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_enum_members().

const char* gr_get_enum_type_name gr_graph_t gr,
gr_id_t  enum_id
 

Get the name of a enum type.

Parameters:
gr The graph.
enum_id Enum type ID.
Returns:
The name of the enum type or NULL if an invalid ID was passed.

Definition at line 483 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_enum_type_name(), gr_dump_edge_attr(), and gr_dump_node_attr().

void gr_get_incoming gr_graph_t g,
gr_id_t  n,
gr_id_t  et,
gr_set_t s
 

Get the incoming edges of a node.

Parameters:
g The graph.
n The node's ID.
et Just consider edges of this type.
s A set, where all the incoming edges are put into. The set is not cleared in advance.

Definition at line 345 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by check_incoming(), cm_get_incoming(), and dump_get_leaf_nodes().

void gr_get_node_attr gr_graph_t g,
gr_id_t  n,
gr_id_t  attr,
gr_value_t v
 

Get an attribute's value of a node.

Parameters:
g The graph.
n The ID of the node.
attr The ID of the attribute.
v A pointer to a value, where the attribute's is filled in.

Definition at line 297 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_attr(), gr_dump_node_attr(), gr_get_node_infotag(), and node_attrs_conf_factory().

gr_id_t gr_get_node_attr_id gr_graph_t gr,
gr_id_t  type_id,
const char *  attr_name
 

Get the ID of a node type attribute type with a given attribute name.

Parameters:
gr The graph.
type_id The ID of the type, which contains the attribute.
attr_name The name of the attribute.
Returns:
The ID of the attribute, or an invalid ID, if the attribute name is not available in the graph.

Definition at line 427 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_attr_id(), and vcg_dump().

void gr_get_node_attr_ids const gr_graph_t gr,
gr_set_t set
 

Get the set of valid node attribute ids.

Parameters:
gr The graph.
set The set to them into.

Definition at line 156 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_attr_ids(), gr_dump_node_attr(), and node_attrs_conf_factory().

const char* gr_get_node_attr_name gr_graph_t gr,
gr_id_t  na
 

Get the name of a node attribute.

Parameters:
gr The graph.
na Node attribute ID.
Returns:
The name of the attribute or NULL if an invalid attribute ID was passed.

Definition at line 409 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_attr_name(), gr_dump_node_attr(), and node_attrs_conf_factory().

gr_at_t gr_get_node_attr_type_kind gr_graph_t gr,
gr_id_t  node_attr,
gr_id_t enum_type_id
 

Get the type kind of a node attribute.

Parameters:
gr The graph.
node_attr The node attribute.
enum_type_id If it's a enum type contains the enum type id here.
Returns:
The type kind of the node attribute.

Definition at line 465 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_attr_type_kind(), and gr_dump_node_attr().

gr_id_t gr_get_node_root_type gr_graph_t gr  ) 
 

Get the node root type (called Node).

Parameters:
gr The graph.
Returns:
The node type ID for the root type.

Definition at line 183 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_root_type(), get_all_edges(), gr_dump_match(), and gr_get_all_nodes().

gr_id_t gr_get_node_type_id gr_graph_t gr,
const char *  type_name
 

Get the ID of a node type with a given type name.

Parameters:
gr The graph.
type_name The name of the type.
Returns:
The ID of the type, or an invalid ID, if the type name is not available in the graph.

Definition at line 391 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by add_nodes(), and cm_get_node_type_id().

void gr_get_node_type_ids const gr_graph_t gr,
gr_set_t set
 

Get the set of valid node type ids.

Parameters:
gr The graph.
set The set to them into.

Definition at line 138 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_type_ids().

const char* gr_get_node_type_name gr_graph_t gr,
gr_id_t  nt
 

Get the name of a node type.

Parameters:
gr The graph.
nt The node type ID.
Returns:
The name of the node type, NULL if an invalid node type ID was given.

Definition at line 373 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_type_name(), gr_dump_node_attr(), gr_node_label(), print_edges_error(), and validate().

void gr_get_node_type_super_type gr_graph_t gr,
gr_id_t  type_id,
gr_set_t set
 

Get the type id of the direct super type(s) of a node type.

Parameters:
gr The graph.
type_id Node type ID.
set after successful call contains the set of super types

Definition at line 521 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_node_type_super_type().

gr_id_t gr_get_node_type_super_type_old gr_graph_t gr,
gr_id_t  type_id
 

Definition at line 540 of file graph.c.

References gr_id_invalid.

void gr_get_outgoing gr_graph_t g,
gr_id_t  n,
gr_id_t  et,
gr_set_t s
 

Get the outgoing edges of a node.

Parameters:
g The graph.
n The node's ID.
et Just consider edges of this type.
s A set, where all the outgoing edges are put into. The set is not cleared in advance.

Definition at line 335 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by check_outgoing(), cm_get_outgoing(), dump_edges_from_node(), get_all_edges(), and gr_get_outgoing_edges().

gr_id_t gr_get_owner_type_of_edge_attr gr_graph_t gr,
gr_id_t  edge_attr
 

Get the owner type of a edge attribute.

Parameters:
gr The graph.
edge_attr The edge attribute.
Returns:
The type id of the edge attribute or gr_id_invalid, if the edge attribute didn't exist.

Definition at line 456 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_owner_type_of_edge_attr(), edge_attrs_conf_factory(), and gr_dump_edge_attr().

gr_id_t gr_get_owner_type_of_node_attr gr_graph_t gr,
gr_id_t  node_attr
 

Get the owner type of a node attribute.

Parameters:
gr The graph.
node_attr The node attribute.
Returns:
The type id of the node attribute or gr_id_invalid, if the node attribute didn't exist.

Definition at line 447 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_owner_type_of_node_attr(), gr_dump_node_attr(), and node_attrs_conf_factory().

gr_id_t gr_get_source gr_graph_t g,
gr_id_t  e
 

Get the source node of an edge.

Parameters:
g The graph.
e The edge.
Returns:
The node's ID of the source of the edge.

Definition at line 355 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_source(), dump_get_leaf_nodes(), gr_copy_edges(), gr_dump_match(), and print_edges_error().

char* gr_get_status gr_graph_t gr,
char *  buf,
int  len
 

Get a string describing some status information about the graph.

Parameters:
gr The graph.
buf The buffer to put the string into.
len The size of buf.
Returns:
The status string (buf).

Definition at line 85 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_stat().

gr_id_t gr_get_target gr_graph_t g,
gr_id_t  e
 

Get the target node of an edge.

Parameters:
g The graph.
e The edge.
Returns:
The node's ID of the target of the edge.

Definition at line 364 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_target(), dump_edges_from_node(), gr_copy_edges(), gr_dump_match(), and print_edges_error().

gr_id_t gr_get_type_of_edge gr_graph_t gr,
gr_id_t  edge
 

Get the type of a edge.

Parameters:
gr The graph.
edge The edge.
Returns:
The type id of the edge or gr_id_invalid, if the edge didn't exist.

Definition at line 288 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by edge_attrs_conf_factory(), gr_copy_edges(), gr_dump_edge_attr(), gr_edge_instanceof(), gr_edge_label(), gr_get_def_edge_color(), and print_edges_error().

gr_id_t gr_get_type_of_node gr_graph_t gr,
gr_id_t  node
 

Get the type of a node.

Parameters:
gr The graph.
node The node.
Returns:
The type id of the node or gr_id_invalid, if the node didn't exist.

Definition at line 279 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_get_type_of_edge(), cm_get_type_of_node(), gr_copy_nodes(), gr_dump_node_attr(), gr_get_def_node_color(), gr_get_node_infotag(), gr_node_instanceof(), gr_node_label(), node_attrs_conf_factory(), and print_edges_error().

void* gr_graph_add_listener gr_graph_t gr,
gr_listener_event_t  event,
gr_gen_listen_func_t func,
void *  context
 

Add a new listener function.

Parameters:
gr The graph.
event The event that should be listened.
func The listener function that will be called.
context The context that will be transmitted.
Returns:
a listener ID that can be used to remove the listener.

Definition at line 1397 of file graph.c.

References ASSERT_GR, _gr_generic_listener_t::context, GR_LISTENER_MAX, GR_RANGE_CHECK, _gr_generic_listener_t::listener_func, _gr_generic_listener_t::next, and _gr_generic_listener_t::prev.

Referenced by gr_install_generations().

int gr_graph_custom gr_graph_t gr,
const char *  which,
  ...
 

Do a graph-backend dependent thing.

Parameters:
gr The graph.
which What to do.
Returns:
0, if failed, 1 else.

Definition at line 1449 of file graph.c.

References ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_custom().

void gr_graph_delete gr_graph_t g  ) 
 

Delete a graph. This frees all memory used by the graph.

Parameters:
g The graph to free.

Definition at line 76 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_del().

const char* gr_graph_get_name const gr_graph_t gr  ) 
 

Get the name of the graph.

Parameters:
gr The graph.
Returns:
The name of the graph.

Definition at line 71 of file graph.c.

struct _gr_actions_model_t* gr_graph_load_actions_model gr_graph_t gr,
const char *  filename
 

Load an actions model from a file.

Parameters:
gr The graph.
filename The library to load the model from.
Returns:
The actions model if loaded successfully, NULL otherwise.

Definition at line 47 of file graph_ld_unx.c.

References ASSERT_GR, and gr_error().

void gr_graph_mature gr_graph_t gr  ) 
 

Mature a graph. This method should be invoked after adding all nodes and edges to the graph. The backend may implement analyses on the graph to speed up matching and so on. The backend may also do nothing upon invoking this function. further on, the graph may not be modifyied by this functions.

Parameters:
gr The graph.

Definition at line 530 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_mature().

void gr_graph_remove_listener gr_graph_t gr,
void *  listener_ID
 

Deletes a listener function.

Parameters:
gr The graph.
listener_ID The listener ID of the listener that should be deleted.

Definition at line 1428 of file graph.c.

References ASSERT_GR, _gr_generic_listener_t::next, and _gr_generic_listener_t::prev.

int gr_graph_validate gr_graph_t gr,
int  strict
 

Checks whether a graph meets the connection assertions of not. In strict mode all occouring connections must be specified by a connection assertion.

Parameters:
gr The graph.
strict Iff 0 we only check for specified assertions, otherweise it is a error if a edge connects nodes without a specified connection assertion.
Returns:
0 iff failed, 1 iff success

Definition at line 1674 of file graph.c.

References ASSERT_GR, ASSERT_MODEL, and validate().

struct _gr_actions_t* gr_new_actions gr_graph_t gr,
const struct _gr_actions_model_t am
 

Instantiate an action model from a graph.

Parameters:
gr The graph.
am The actions model.
Returns:
The new actions model.

int gr_node_instanceof gr_graph_t gr,
gr_id_t  node,
gr_id_t  type
 

Check, if a node is an instance of a given node type.

Parameters:
gr The graph.
node The node to check for.
type The node type to be checked against.
Returns:
1, if node is an instance of type.

Definition at line 112 of file graph.c.

References gr_get_type_of_node(), and gr_node_type_is_a().

int gr_node_type_is_a gr_graph_t gr,
gr_id_t  nt1,
gr_id_t  nt2
 

Check, if a node type is compatible to another node type.

Parameters:
gr The graph.
nt1 The node type to check for.
nt2 The other node type.
Returns:
1, if nt1 is compatible to nt2.

Definition at line 100 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_node_type_is_a(), gr_dump_node_attr(), gr_node_instanceof(), and node_attrs_conf_factory().

int gr_remove_edge gr_graph_t gr,
gr_id_t  edge
 

Remove an edge.

Parameters:
gr The graph.
edge The edge's ID.
Returns:
1 if the edge was removed properly, 0 otherwise.

Definition at line 242 of file graph.c.

References ASSERT_FKT, ASSERT_GR, ASSERT_MODEL, GR_LISTENER_DEL_EDGE, and run_graph_listener().

Referenced by cm_remove_edge().

int gr_remove_edges_of_node gr_graph_t gr,
gr_id_t  node
 

Remove all edges, that end in or leave a node.

Parameters:
gr The graph.
node The node.
Returns:
1, if the edges were removed properly, 0 if not.
Note:
After calling this function, the node can be removed from the graph, since it has no incoming or outgoing edges anymore.

Definition at line 253 of file graph.c.

References ASSERT_FKT, ASSERT_GR, ASSERT_MODEL, GR_LISTENER_DEL_EDGES, and run_graph_listener().

Referenced by cm_remove_edges_of_node().

int gr_remove_node gr_graph_t gr,
gr_id_t  node
 

Remove a node from the graph.

Parameters:
gr The graph.
node The node's ID.
Returns:
1, if the node's ID was valid and the node was removed from the graph properly, 0 otherwise.

Definition at line 231 of file graph.c.

References ASSERT_FKT, ASSERT_GR, ASSERT_MODEL, GR_LISTENER_DEL_NODE, and run_graph_listener().

Referenced by cm_remove_node().

void gr_set_edge_attr gr_graph_t g,
gr_id_t  e,
gr_id_t  attr,
const gr_value_t v
 

Set an attribute's value of a edge.

Parameters:
g The graph.
e The edge's ID.
attr The ID of the attribute.
v The value to set for this attribute.

Definition at line 325 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_set_edge_attr(), edge_attrs_conf_factory(), gr_act_match(), and gr_graph_add_edge().

void gr_set_node_attr gr_graph_t g,
gr_id_t  n,
gr_id_t  attr,
const gr_value_t v
 

Set an attribute's value of a node.

Parameters:
g The graph.
n The node's ID.
attr The ID of the attribute.
v The value to set for this attribute.

Definition at line 315 of file graph.c.

References ASSERT_FKT, ASSERT_GR, and ASSERT_MODEL.

Referenced by cm_set_node_attr(), gr_act_match(), gr_graph_add_node(), gr_graph_set_node_type(), and node_attrs_conf_factory().

int gr_set_type_of_node gr_graph_t gr,
gr_id_t  node,
gr_id_t  type
 

Set the type of a node.

Parameters:
gr The graph.
node The node whose type to set.
type The new type of the node.
Returns:
1, if the operation succeeded, 0 if either node was an invalid node id, or type an invalid type id.

Definition at line 264 of file graph.c.

References ASSERT_FKT, ASSERT_GR, ASSERT_MODEL, GR_LISTENER_SET_NODE_TYPE, and run_graph_listener().

Referenced by cm_set_type_of_node().


Generated on Wed Apr 5 15:28:20 2006 for libgr by  doxygen 1.4.1