caugi-equality: Equality operators for caugi objects

caugi-equalityR Documentation

Equality operators for caugi objects

Description

S3 methods for == and != that compare two caugi objects by their graph content (nodes, edges, simple, class) rather than session identity. Returns FALSE (resp. TRUE) when the other operand is not a caugi object.

Usage

## S3 method for class ''caugi::caugi''
e1 == e2

## S3 method for class ''caugi::caugi''
e1 != e2

Arguments

e1, e2

A caugi object (one or both sides).

Details

Row order is ignored, and an edge whose glyph is symmetric in the graph's own edge registry is compared as an unordered pair, so A --- B and B --- A are the same edge. Edges are also compared by their full definition, so a glyph re-registered with a different meaning does not match the original. Asymmetric glyphs are direction-sensitive, so ⁠A --> B⁠ and ⁠B --> A⁠ are not.

Value

A single logical.

See Also

Other caugi methods: length.caugi(), print.caugi()

Examples

cg1 <- caugi(A %-->% B, class = "DAG")
cg2 <- caugi(A %-->% B, class = "DAG")
cg1 == cg2 # TRUE
cg1 != caugi(A %-->% C, class = "DAG") # TRUE

# Symmetric edges are unordered, so these are the same graph.
caugi(A %---% B, class = "UG") == caugi(B %---% A, class = "UG") # TRUE

# Directed edges are not.
caugi(A %-->% B, class = "DAG") == caugi(B %-->% A, class = "DAG") # FALSE


caugi documentation built on Oct. 28, 2026, 1:07 a.m.