Class VertexPainter

Class Documentation

class VertexPainter

Can be used to assign unique colors to a set of objects. The class automatically ensures that there are no accidental color duplications for objects that actually should have different colors (i.e. this is more than a hash function). It is intended to be used to determine the vertex colors in a colored graph representing a tensor network.

Public Types

using Color = TensorNetworkV2::Graph::VertexColor
using VertexData = std::variant<const AbstractTensor*, Index, const ProtoBundle*, BraGroup, KetGroup, AuxGroup, ParticleGroup>
using ColorMap = container::map<Color, VertexData>

Public Functions

VertexPainter(const TensorNetworkV2::NamedIndexSet &named_indices, bool distinct_named_indices = true)
Parameters:
  • named_indices – indices not in this list will use colors based on their Index::color()

  • distinct_named_indices – if false, will use same color for all named indices that have same Index::color(), else will use distinct color for each named_index

const ColorMap &used_colors() const
Color operator()(const AbstractTensor &tensor)
Color operator()(const BraGroup &group)
Color operator()(const KetGroup &group)
Color operator()(const AuxGroup &group)
Color operator()(const ParticleGroup &group)
Color operator()(const Index &idx)
Color operator()(const ProtoBundle &bundle)