python-igraph API reference

List of all classes, functions and methods in python-igraph

class documentation

class AttributeCollectorMeta(type):

View In Hierarchy

Metaclass for attribute collector classes

Classes that use this metaclass are intended to collect vertex/edge attributes from various sources (a Python dict, a vertex/edge sequence, default values from the igraph configuration and such) in a given order of precedence. See the module documentation for more details. This metaclass enables the user to use a simple declarative syntax to specify which attributes he is interested in. For each vertex/edge attribute, a corresponding class attribute must be defined with a value that describes the default value of that attribute if no other data source provides us with any suitable value. The default value can also be a tuple; in that case, the first element of the tuple is the actual default value, the second element is a converter function that will convert the attribute values to a format expected by the caller who uses the class being defined.

There is a special class attribute called _kwds_prefix; this is not used as an attribute declaration. It can contain a string which will be used to derive alternative names for the attributes when the attribute is accessed in a Python dict. This is useful in many situations; for instance, the default graph drawer would want to access the vertex colors using the color vertex attribute, but when it looks at the keyword arguments passed to the original call of igraph.Graph.__plot__, the vertex_color keyword argument should be looked up because we also have colors for the edges. _kwds_prefix will be prepended to the attribute names when they are looked up in a dict of keyword arguments.

If you require a more fine-tuned behaviour, you can assign an AttributeSpecification instance to a class attribute directly.

See Also
AttributeCollectorBase
Class Method record_generator Generates a simple class that has the given slots and nothing else
Method __new__ Undocumented
@classmethod
def record_generator(mcs, name, slots):

Generates a simple class that has the given slots and nothing else

def __new__(mcs, name, bases, attrs):

Undocumented