SimGrid  3.16
Versatile Simulation of Distributed Systems
General purpose graph library

Detailed Description

A graph data type with several interesting algorithms.

Classes

struct  xbt_node
 
struct  xbt_edge
 
struct  xbt_graph
 

Typedefs

typedef struct xbt_nodexbt_node_t
 
typedef struct xbt_edgexbt_edge_t
 
typedef struct xbt_graphxbt_graph_t
 
typedef struct xbt_node s_xbt_node_t
 
typedef struct xbt_edge s_xbt_edge_t
 
typedef struct xbt_graph s_xbt_graph_t
 

Functions

xbt_graph_t xbt_graph_new_graph (unsigned short int directed, void *data)
 Constructor. More...
 
xbt_node_t xbt_graph_new_node (xbt_graph_t g, void *data)
 add a node to the given graph More...
 
xbt_edge_t xbt_graph_new_edge (xbt_graph_t g, xbt_node_t src, xbt_node_t dst, void *data)
 add an edge to the given graph More...
 
voidxbt_graph_node_get_data (xbt_node_t node)
 Get the user data associated to a node. More...
 
void xbt_graph_node_set_data (xbt_node_t node, void *data)
 Set the user data associated to a node. More...
 
voidxbt_graph_edge_get_data (xbt_edge_t edge)
 Get the user data associated to a edge. More...
 
void xbt_graph_edge_set_data (xbt_edge_t edge, void *data)
 Set the user data associated to a edge. More...
 
xbt_edge_t xbt_graph_get_edge (xbt_graph_t g, xbt_node_t src, xbt_node_t dst)
 Get the edge connecting src and dst. More...
 
void xbt_graph_edge_set_length (xbt_edge_t e, double length)
 Set the weight of the given edge. More...
 
double xbt_graph_edge_get_length (xbt_edge_t e)
 Get the length of a edge. More...
 
void xbt_graph_free_graph (xbt_graph_t g, void_f_pvoid_t node_free_function, void_f_pvoid_t edge_free_function, void_f_pvoid_t graph_free_function)
 Destructor. More...
 
xbt_dynar_t xbt_graph_get_nodes (xbt_graph_t g)
 Retrieve the graph's nodes as a dynar. More...
 
xbt_dynar_t xbt_graph_get_edges (xbt_graph_t g)
 Retrieve the graph's edges as a dynar. More...
 
xbt_dynar_t xbt_graph_node_get_outedges (xbt_node_t n)
 Retrieve the outgoing edges of the given node. More...
 
xbt_node_t xbt_graph_edge_get_source (xbt_edge_t e)
 Retrieve the node at the source of the given edge. More...
 
xbt_node_t xbt_graph_edge_get_target (xbt_edge_t e)
 Retrieve the node being the target of the given edge. More...
 
void xbt_graph_export_graphviz (xbt_graph_t g, const char *filename, const char *(node_name)(xbt_node_t n), const char *(edge_name)(xbt_edge_t e))
 

Typedef Documentation

◆ xbt_node_t

typedef struct xbt_node* xbt_node_t

◆ xbt_edge_t

typedef struct xbt_edge* xbt_edge_t

◆ xbt_graph_t

typedef struct xbt_graph* xbt_graph_t

◆ s_xbt_node_t

typedef struct xbt_node s_xbt_node_t

◆ s_xbt_edge_t

typedef struct xbt_edge s_xbt_edge_t

◆ s_xbt_graph_t

typedef struct xbt_graph s_xbt_graph_t

Function Documentation

◆ xbt_graph_new_graph()

xbt_graph_t xbt_graph_new_graph ( unsigned short int  directed,
void data 
)

Constructor.

Returns
a new graph

◆ xbt_graph_new_node()

xbt_node_t xbt_graph_new_node ( xbt_graph_t  g,
void data 
)

add a node to the given graph

◆ xbt_graph_new_edge()

xbt_edge_t xbt_graph_new_edge ( xbt_graph_t  g,
xbt_node_t  src,
xbt_node_t  dst,
void data 
)

add an edge to the given graph

◆ xbt_graph_node_get_data()

void* xbt_graph_node_get_data ( xbt_node_t  node)

Get the user data associated to a node.

◆ xbt_graph_node_set_data()

void xbt_graph_node_set_data ( xbt_node_t  node,
void data 
)

Set the user data associated to a node.

◆ xbt_graph_edge_get_data()

void* xbt_graph_edge_get_data ( xbt_edge_t  edge)

Get the user data associated to a edge.

◆ xbt_graph_edge_set_data()

void xbt_graph_edge_set_data ( xbt_edge_t  edge,
void data 
)

Set the user data associated to a edge.

◆ xbt_graph_get_edge()

xbt_edge_t xbt_graph_get_edge ( xbt_graph_t  g,
xbt_node_t  src,
xbt_node_t  dst 
)

Get the edge connecting src and dst.

◆ xbt_graph_edge_set_length()

void xbt_graph_edge_set_length ( xbt_edge_t  e,
double  length 
)

Set the weight of the given edge.

◆ xbt_graph_edge_get_length()

double xbt_graph_edge_get_length ( xbt_edge_t  e)

Get the length of a edge.

◆ xbt_graph_free_graph()

void xbt_graph_free_graph ( xbt_graph_t  g,
void_f_pvoid_t  node_free_function,
void_f_pvoid_t  edge_free_function,
void_f_pvoid_t  graph_free_function 
)

Destructor.

Parameters
gpoor victim
node_free_functionfunction to use to free data associated to each node
edge_free_functionfunction to use to free data associated to each edge
graph_free_functionfunction to use to free data associated to g

Free the graph structure.

◆ xbt_graph_get_nodes()

xbt_dynar_t xbt_graph_get_nodes ( xbt_graph_t  g)

Retrieve the graph's nodes as a dynar.

◆ xbt_graph_get_edges()

xbt_dynar_t xbt_graph_get_edges ( xbt_graph_t  g)

Retrieve the graph's edges as a dynar.

◆ xbt_graph_node_get_outedges()

xbt_dynar_t xbt_graph_node_get_outedges ( xbt_node_t  n)

Retrieve the outgoing edges of the given node.

◆ xbt_graph_edge_get_source()

xbt_node_t xbt_graph_edge_get_source ( xbt_edge_t  e)

Retrieve the node at the source of the given edge.

◆ xbt_graph_edge_get_target()

xbt_node_t xbt_graph_edge_get_target ( xbt_edge_t  e)

Retrieve the node being the target of the given edge.

◆ xbt_graph_export_graphviz()

void xbt_graph_export_graphviz ( xbt_graph_t  g,
const char *  filename,
const char *  node_name)(xbt_node_t n,
const char *  edge_name)(xbt_edge_t e 
)