Learn R Programming

cayleyR (version 0.2.1)

manhattan_distance: Manhattan Distance Between Two States

Description

Computes the sum of absolute differences between corresponding elements of two permutation states.

Usage

manhattan_distance(start_state, target_state)

Value

Numeric, the Manhattan distance

Arguments

start_state

Integer vector, first state

target_state

Integer vector, second state

Examples

Run this code
manhattan_distance(1:5, 5:1)
manhattan_distance(1:5, 1:5)

Run the code above in your browser using DataLab