Ufo.Graph

g GObject.Object GObject.Object Ufo.Graph Ufo.Graph GObject.Object->Ufo.Graph

Subclasses:

Ufo.TaskGraph

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

connect_nodes (source, target, label)

dump_dot (filename)

expand (path)

find_longest_path (pred, *user_data)

get_edge_label (source, target)

get_edges ()

get_leaves ()

get_nodes ()

get_nodes_filtered (func, *user_data)

get_num_edges ()

get_num_nodes ()

get_num_predecessors (node)

get_num_successors (node)

get_predecessors (node)

get_roots ()

get_successors (node)

is_connected (from_, to)

remove_edge (source, target)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Ufo.Graph(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Ufo.GraphClass

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

classmethod new()
Returns:

A Ufo.Graph.

Return type:

Ufo.Graph

Create a new Ufo.Graph object.

connect_nodes(source, target, label)
Parameters:

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

dump_dot(filename)
Parameters:

filename (str) – A string containing a filename

Stores a GraphViz dot representation of self in filename.

expand(path)
Parameters:

path ([Ufo.Node]) – A path of nodes.

Raises:

GLib.Error

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

find_longest_path(pred, *user_data)
Parameters:
Returns:

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

Return type:

[Ufo.Node]

Find the longest path in task_graph that fulfills pred.

get_edge_label(source, target)
Parameters:
Returns:

Edge label pointer.

Return type:

object or None

Retrieve edge label between source and target.

get_edges()
Returns:

a list of Ufo.Edge elements or None on error. Release the list with g_list_free().

Return type:

[Ufo.Edge]

Get all edges contained in self.

get_leaves()
Returns:

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

Return type:

[Ufo.Node]

Get all leaves of self.

get_nodes()
Returns:

A list of all nodes added to self.

Return type:

[Ufo.Node]

get_nodes_filtered(func, *user_data)
Parameters:
Returns:

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

Return type:

[Ufo.Node]

Get nodes filtered by the predicate func.

get_num_edges()
Returns:

Number of edges.

Return type:

int

Get number of edges present in self.

get_num_nodes()
Returns:

Number of nodes.

Return type:

int

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

get_num_predecessors(node)
Parameters:

node (Ufo.Node) –

Return type:

int

get_num_successors(node)
Parameters:

node (Ufo.Node) –

Return type:

int

get_predecessors(node)
Parameters:

node (Ufo.Node) – A Ufo.Node whose predecessors are returned.

Returns:

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

Return type:

[Ufo.Node]

Get the all nodes connected to node.

get_roots()
Returns:

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

Return type:

[Ufo.Node]

Get all roots of self.

get_successors(node)
Parameters:

node (Ufo.Node) – A Ufo.Node whose successors are returned.

Returns:

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

Return type:

[Ufo.Node]

Get the successors of node.

is_connected(from_, to)
Parameters:
Returns:

True if from is connected to to, otherwise False.

Return type:

bool

Check whether from is connected to to.

remove_edge(source, target)
Parameters:

Remove edge between source and target.