Package pygraph :: Package mixins :: Module labeling :: Class labeling

# Class labeling

Generic labeling support for graphs

Instance Methods

boolean

__eq__(self, other) Return whether this graph is equal to another one. |

__init__(self) x.__init__(...) initializes x; see help(type(x)) for signature |

add_edge_attribute(self, edge, attr) Add attribute to the given edge. |

add_edge_attributes(self, edge, attrs) Append a sequence of attributes to the given edge |

add_node_attribute(self, node, attr) Add attribute to the given node. |

del_edge_labeling(self, edge) |

del_node_labeling(self, node) |

list

edge_attributes(self, edge) Return the attributes of the given edge. |

string

edge_label(self, edge) Get the label of an edge. |

number

edge_weight(self, edge) Get the weight of an edge. |

get_edge_properties(self, edge) |

list

node_attributes(self, node) Return the attributes of the given node. |

set_edge_label(self, edge, label) Set the label of an edge. |

set_edge_properties(self, edge, **properties) |

set_edge_weight(self, edge, wt) Set the weight of an edge. |

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
| WEIGHT_ATTRIBUTE_NAME = ``'``weight``'``
| DEFAULT_WEIGHT = `1`
| LABEL_ATTRIBUTE_NAME = ``'``label``'``
| DEFAULT_LABEL = ``'````'``

Properties
Inherited from `object`: `__class__`

Method Details

### __eq__(self, other)
(Equality operator)

Return whether this graph is equal to another one.

Parameters:
  - `other` (graph, digraph) - Other graph or digraph
Returns: boolean
  Whether this graph and the other are equal.

### __init__(self)
(Constructor)

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### add_edge_attribute(self, edge, attr)

Add attribute to the given edge.

Parameters:
  - `edge` (edge) - One edge.
  - `attr` (tuple) - Node attribute specified as a tuple in the form (attribute, value).

### add_edge_attributes(self, edge, attrs)

Append a sequence of attributes to the given edge

Parameters:
  - `edge` (edge) - One edge.
  - `attrs` (tuple) - Node attributes specified as a sequence of tuples in the form (attribute, value).

### add_node_attribute(self, node, attr)

Add attribute to the given node.

Parameters:
  - `node` (node) - Node identifier
  - `attr` (tuple) - Node attribute specified as a tuple in the form (attribute, value).

### edge_attributes(self, edge)

Return the attributes of the given edge.

Parameters:
  - `edge` (edge) - One edge.
Returns: list
  List of attributes specified tuples in the form (attribute, value).

### edge_label(self, edge)

Get the label of an edge.

Parameters:
  - `edge` (edge) - One edge.
Returns: string
  Edge label

### edge_weight(self, edge)

Get the weight of an edge.

Parameters:
  - `edge` (edge) - One edge.
Returns: number
  Edge weight.

### node_attributes(self, node)

Return the attributes of the given node.

Parameters:
  - `node` (node) - Node identifier
Returns: list
  List of attributes specified tuples in the form (attribute, value).

### set_edge_label(self, edge, label)

Set the label of an edge.

Parameters:
  - `edge` (edge) - One edge.
  - `label` (string) - Edge label.

### set_edge_weight(self, edge, wt)

Set the weight of an edge.

Parameters:
  - `edge` (edge) - One edge.
  - `wt` (number) - Edge weight.