class AttributeCollectorBase(object):
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.
Method | __getitem__ |
Returns the collected attributes of the vertex/edge with the given index. |
Method | __init__ |
Constructs a new attribute collector that uses the given vertex/edge sequence and the given dict as data sources. |
Method | __len__ |
Undocumented |
Instance Variable | kwds |
Undocumented |
Instance Variable | seq |
Undocumented |
Method | _collect |
Collects graph visualization attributes from various sources. |
Instance Variable | _cache |
Undocumented |
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. |
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 attrspec.
- 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 attrspec.
Parameters | |
attr | 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 |