def METHOD_NAME(self, diagram: ClassDiagram) -> None:
    """Write a class diagram."""
    # sorted to get predictable (hence testable) results
    for obj in sorted(diagram.objects, key=lambda x: x.title):
        obj.fig_id = obj.node.qname()
        if self.config.no_standalone and not any(
            obj in (rel.from_object, rel.to_object)
            for rel_type in ("specialization", "association", "aggregation")
            for rel in diagram.get_relationships(rel_type)
        ):
            continue
        self.printer.emit_node(
            obj.fig_id,
            type_=NodeType.CLASS,
            properties=self.get_class_properties(obj),
        )
    # inheritance links
    for rel in diagram.get_relationships("specialization"):
        self.printer.emit_edge(
            rel.from_object.fig_id,
            rel.to_object.fig_id,
            type_=EdgeType.INHERITS,
        )
    # generate associations
    for rel in diagram.get_relationships("association"):
        self.printer.emit_edge(
            rel.from_object.fig_id,
            rel.to_object.fig_id,
            label=rel.name,
            type_=EdgeType.ASSOCIATION,
        )
    # generate aggregations
    for rel in diagram.get_relationships("aggregation"):
        self.printer.emit_edge(
            rel.from_object.fig_id,
            rel.to_object.fig_id,
            label=rel.name,
            type_=EdgeType.AGGREGATION,
        )