Table of Contents

Delegate AttributeHook

Namespace
Graphity.Dot
Assembly
Graphity.Dot.dll

A hook that puts the attributes of one node or edge, by node ID or edge index, for NodeAttributes(AttributeHook) and EdgeAttributes(AttributeHook).

public delegate void AttributeHook(int id, IDictionary<string, string> attributes)

Parameters

id int

The node ID or edge index.

attributes IDictionary<string, string>

The attributes to write, by name.

Remarks

The attributes, such as color or shape, are those of DOT (the language of Graphviz). The writer passes a dictionary from attribute name to value. It holds the label from NodeLabel(Func<int, string?>) or EdgeLabel(Func<int, string?>) as the attribute label, if there is one, and nothing else; the hook can add attributes, and replace or remove the label. The writer writes the attributes in the order they were put and escapes their values; a name that is not an identifier or is a DOT keyword makes Write(TextWriter) throw an ArgumentException. The writer reuses the dictionary for every node and edge, so the hook must not keep it.

Puts the attributes of the node or edge id into attributes. Put an attribute through the indexer: attributes["color"] = "red". Setting an existing name keeps its place in the order, while Add throws for an existing name, as IDictionary<TKey, TValue> specifies.