UfoGraph

UfoGraph — Generic graph structure

Functions

Types and Values

struct UfoEdge
struct UfoGraph
struct UfoGraphClass

Object Hierarchy

    GObject
    ╰── UfoGraph
        ╰── UfoTaskGraph

Description

Functions

UfoFilterPredicate ()

gboolean
(*UfoFilterPredicate) (UfoNode *node,
                       gpointer user_data);

ufo_graph_new ()

UfoGraph *
ufo_graph_new (void);

Create a new UfoGraph object.

Returns

A UfoGraph.

[transfer full]


ufo_graph_connect_nodes ()

void
ufo_graph_connect_nodes (UfoGraph *graph,
                         UfoNode *source,
                         UfoNode *target,
                         gpointer label);

Connect source with target in graph and annotate the edge with label .

Parameters

graph

A UfoGraph

 

source

A source node

 

target

A target node

 

label

An arbitrary label

 

ufo_graph_is_connected ()

gboolean
ufo_graph_is_connected (UfoGraph *graph,
                        UfoNode *from,
                        UfoNode *to);

Check whether from is connected to to .

Parameters

graph

A UfoGraph

 

from

A source node

 

to

A target node

 

Returns

TRUE if from is connected to to , otherwise FALSE.


ufo_graph_remove_edge ()

void
ufo_graph_remove_edge (UfoGraph *graph,
                       UfoNode *source,
                       UfoNode *target);

Remove edge between source and target .

Parameters

graph

A UfoGraph

 

source

A source node

 

target

A target node

 

ufo_graph_get_edge_label ()

gpointer
ufo_graph_get_edge_label (UfoGraph *graph,
                          UfoNode *source,
                          UfoNode *target);

Retrieve edge label between source and target .

Parameters

graph

A UfoGraph

 

source

Source node

 

target

Target node

 

Returns

Edge label pointer.

[transfer none]


ufo_graph_get_num_nodes ()

guint
ufo_graph_get_num_nodes (UfoGraph *graph);

Get number of nodes in graph . The number is always divisible by two, because nodes are only part of a graph if member of an edge.

Parameters

graph

A UfoGraph

 

Returns

Number of nodes.


ufo_graph_get_nodes ()

GList *
ufo_graph_get_nodes (UfoGraph *graph);

Parameters

graph

A UfoGraph

 

Returns

A list of all nodes added to graph .

[element-type UfoNode][transfer container]


ufo_graph_get_nodes_filtered ()

GList *
ufo_graph_get_nodes_filtered (UfoGraph *graph,
                              UfoFilterPredicate func,
                              gpointer user_data);

Get nodes filtered by the predicate func .

Parameters

graph

A UfoGraph

 

func

Predicate function to filter out nodes.

[scope call]

user_data

Data to be passed to func on invocation

 

Returns

A list of all nodes that are marked as true by the predicate function func .

[element-type UfoNode][transfer container]


ufo_graph_get_num_edges ()

guint
ufo_graph_get_num_edges (UfoGraph *graph);

Get number of edges present in graph .

Parameters

graph

A UfoGraph

 

Returns

Number of edges.


ufo_graph_get_edges ()

GList *
ufo_graph_get_edges (UfoGraph *graph);

Get all edges contained in graph .

Parameters

graph

A UfoGraph

 

Returns

a list of UfoEdge elements or NULL on error. Release the list with g_list_free().

[transfer full][element-type UfoEdge]


ufo_graph_get_roots ()

GList *
ufo_graph_get_roots (UfoGraph *graph);

Get all roots of graph .

Parameters

graph

A UfoGraph

 

Returns

A list of all nodes that do not have a predessor node.

[element-type UfoNode][transfer container]


ufo_graph_get_leaves ()

GList *
ufo_graph_get_leaves (UfoGraph *graph);

Get all leaves of graph .

Parameters

graph

A UfoGraph

 

Returns

A list of all nodes that do not have a predessor node.

[element-type UfoNode][transfer container]


ufo_graph_get_num_predecessors ()

guint
ufo_graph_get_num_predecessors (UfoGraph *graph,
                                UfoNode *node);

ufo_graph_get_predecessors ()

GList *
ufo_graph_get_predecessors (UfoGraph *graph,
                            UfoNode *node);

Get the all nodes connected to node .

Parameters

graph

A UfoGraph

 

node

A UfoNode whose predecessors are returned.

 

Returns

A list with preceeding nodes of node . Free the list with g_list_free() but not its elements.

[element-type UfoNode][transfer container]


ufo_graph_get_num_successors ()

guint
ufo_graph_get_num_successors (UfoGraph *graph,
                              UfoNode *node);

ufo_graph_get_successors ()

GList *
ufo_graph_get_successors (UfoGraph *graph,
                          UfoNode *node);

Get the successors of node .

Parameters

graph

A UfoGraph

 

node

A UfoNode whose successors are returned.

 

Returns

A list with succeeding nodes of node . Free the list with g_list_free() but not its elements.

[element-type UfoNode][transfer container]


ufo_graph_find_longest_path ()

GList *
ufo_graph_find_longest_path (UfoGraph *graph,
                             UfoFilterPredicate pred,
                             gpointer user_data);

Find the longest path in task_graph that fulfills pred .

Parameters

graph

A UfoGraph

 

pred

Predicate function for which elements of the path must evaluate to TRUE.

[scope call]

user_data

User data passed to pred .

 

Returns

A list with nodes in subsequent order of the path. User must free it with g_list_free.

[transfer full][element-type UfoNode]


ufo_graph_expand ()

void
ufo_graph_expand (UfoGraph *graph,
                  GList *path,
                  GError **error);

Duplicate nodes between head and tail of path and insert at the exact the position of where path started and ended.

Parameters

graph

A UfoGraph

 

path

A path of nodes.

[element-type UfoNode]

error

error to pass on

 

ufo_graph_dump_dot ()

void
ufo_graph_dump_dot (UfoGraph *graph,
                    const gchar *filename);

Stores a GraphViz dot representation of graph in filename .

Parameters

graph

A UfoGraph

 

filename

A string containing a filename

 

Types and Values

struct UfoEdge

struct UfoEdge {
    UfoNode     *source;
    UfoNode     *target;
    gpointer     label;
};

An edge in a UfoGraph.

Members

UfoNode *source;

source node

 

UfoNode *target;

target node

 

gpointer label;

label

 

struct UfoGraph

struct UfoGraph;

Main object for organizing filters. The contents of the UfoGraph structure are private and should only be accessed via the provided API.


struct UfoGraphClass

struct UfoGraphClass {
};

UfoGraph class