generateAdjacencyMatrix(
c("fee", "fie", "foe", "fum", "foo")
)
# No edge connections exist based on a Hamming distance of 1
# (returns a 0x0 sparse matrix)
generateAdjacencyMatrix(
c("foo", "foobar", "fubar", "bar")
)
# Same as the above example, but keeping all nodes
# (returns a 4x4 sparse matrix)
generateAdjacencyMatrix(
c("foo", "foobar", "fubar", "bar"),
drop_isolated_nodes = FALSE
)
# Relaxing the edge criteria using a Hamming distance of 2
# (still results in no edge connections)
generateAdjacencyMatrix(
c("foo", "foobar", "fubar", "bar"),
dist_cutoff = 2
)
# Using a Levenshtein distance of 2, however,
# does result in edge connections
generateAdjacencyMatrix(
c("foo", "foobar", "fubar", "bar"),
dist_type = "levenshtein",
dist_cutoff = 2
)
# Using a Hamming distance of 3
# also results in (different) edge connections
generateAdjacencyMatrix(
c("foo", "foobar", "fubar", "bar"),
dist_cutoff = 3
)
Run the code above in your browser using DataLab