python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Package drawing :: Module metamagic :: Class AttributeCollectorBase
[hide private]

Class AttributeCollectorBase

source code

object --+
         |
        AttributeCollectorBase

Base class for attribute collector subclasses. Classes that inherit this class may use a declarative syntax to specify which vertex or edge attributes they intend to collect. See AttributeCollectorMeta for the details.

Nested Classes [hide private]
  __metaclass__
Metaclass for attribute collector classes
  Element
A simple class that holds the attributes collected by the attribute collector
Instance Methods [hide private]
 
__init__(self, seq, kwds=None)
Constructs a new attribute collector that uses the given vertex/edge sequence and the given dict as data sources.
source code
 
_collect_attributes(self, attr_spec, config=None)
Collects graph visualization attributes from various sources.
source code
 
__getitem__(self, index)
Returns the collected attributes of the vertex/edge with the given index.
source code
 
__len__(self) source code

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

Class Variables [hide private]
  _attributes = []
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, seq, kwds=None)
(Constructor)

source code 

Constructs a new attribute collector that uses the given vertex/edge sequence and the given dict as data sources.

Parameters:
  • seq - an igraph.VertexSeq or igraph.EdgeSeq class that will be used as a data source for attributes.
  • kwds - a Python dict that will be used to override the attributes collected from seq if necessary.
Overrides: object.__init__

_collect_attributes(self, attr_spec, config=None)

source code 

Collects graph visualization attributes from various sources.

This method can be used to collect the attributes required for graph visualization from various sources. Attribute value sources are:

  • A specific value of a Python dict belonging to a given key. This dict is given by the argument self.kwds at construction time, and the name of the key is determined by the argument specification given in attr_spec.
  • A vertex or edge sequence of a graph, given in self.seq
  • The global configuration, given in config
  • A default value when all other sources fail to provide the value. This is also given in attr_spec.
Parameters:
  • attr_spec - an AttributeSpecification object which contains the name of the attribute when it is coming from a list of Python keyword arguments, the name of the attribute when it is coming from the graph attributes directly, the default value of the attribute and an optional callable transformation to call on the values. This can be used to ensure that the attributes are of a given type.
  • config - a Configuration object to be used for determining the defaults if all else fails. If None, the global igraph configuration will be used
Returns:
the collected attributes

   Home       Trees       Indices       Help