This introduces an important concept in graph theory and machine learning: permutation symmetry.

1. What Is a Graph Permutation?

Consider a simple graph:

A—B—C

Its adjacency matrix is:

A=[010101010]

Now suppose we reorder the nodes from (A, B, C) to (B, C, A).

We can represent this reordering using a permutation matrix:

P=[010001100]

The reordered adjacency matrix becomes:

A′=PAPT
A′=[011100100]

Although the adjacency matrices look different, the underlying graph remains identical.

The edges are still A–B and B–C.

A permutation changes how we represent a graph, not its connectivity.

2. Permutation Invariance vs. Equivariance

When designing neural networks for graphs, we want models that respect this symmetry.

Two properties become important.

Permutation Invariance

A function is permutation-invariant if its output remains unchanged regardless of node ordering.

f(PAPT)=f(A)

For example, a neural network producing a single embedding for an entire phylogenetic tree should return the same embedding regardless of how its nodes are indexed.

Permutation Equivariance

A function is permutation-equivariant if reordering its inputs produces a corresponding reordering of its outputs.

f(PAPT)=Pf(A)

For example, suppose a neural network predicts a probability for each node:

[0.2,0.8,0.5]

Reordering the nodes from (A, B, C) to (C, A, B) should produce:

[0.5,0.2,0.8]

The probabilities remain associated with their original nodes; only their positions change.

Invariance preserves the output. Equivariance preserves the correspondence between inputs and outputs.

3. Graph Automorphisms

A graph automorphism is a special permutation that preserves the adjacency matrix itself:

PAPT=A

Consider:

A—B—C

Swapping A and C while keeping B fixed preserves every edge.

The adjacency matrix remains unchanged because both endpoint nodes have identical structural roles.

Not every permutation is an automorphism, but every automorphism is a permutation.

4. Why Does This Matter for Phylogenetic Trees?

Consider two genealogies:

T1=((A, B), (C, D))
T2=((A, C), (B, D))

Both have the same unlabeled tree shape, but they represent different evolutionary relationships.

A neural network should distinguish these genealogies while remaining insensitive to arbitrary node indexing.

This distinction is particularly important when learning neural proposals for ancestral recombination graph (ARG) inference.

A model might use:

  • Permutation-invariant embeddings to represent an entire genealogy.
  • Permutation-equivariant predictions to assign probabilities to branches for subtree pruning and regrafting (SPR).
  • Topology-sensitive representations to distinguish different ancestral relationships among sampled haplotypes.

Sample identities and evolutionary relationships must be preserved even when internal node indices change.

Final Thought

The central idea is simple:

A graph’s representation can change without changing the graph itself.

Permutation symmetry allows neural networks to respect this distinction.

For evolutionary genealogies, the challenge is to ignore arbitrary node ordering while retaining the biological information encoded in the topology.

That is what makes permutation-aware graph representations useful for learning over phylogenetic trees and ancestral recombination graphs.