graphMatch_methods: Methods for the graphMatch class

as.data.frame,graphMatch-methodR Documentation

Methods for the graphMatch class

Description

These methods provide functionality to view, inspect, and convert graphMatch objects.

Usage

## S4 method for signature 'graphMatch'
as.data.frame(x)

## S4 method for signature 'graphMatch'
show(object)

## S4 method for signature 'graphMatch'
print(x)

## S4 method for signature 'graphMatch,missing,missing,missing'
x[i = NULL, j = NULL, drop = NULL]

## S4 method for signature 'graphMatch'
dim(x)

## S4 method for signature 'graphMatch'
length(x)

## S4 method for signature 'graphMatch'
t(x)

## S4 method for signature 'graphMatch'
rev(x)

## S4 method for signature 'graphMatch,ANY,ANY,ANY'
x[i = NULL, j = NULL, drop = NULL]

## S4 method for signature 'graphMatch'
str(object)

## S4 method for signature 'graphMatch'
x$name

Arguments

x

graphMatch object

object

graphMatch object

i

row index for the correspondence data.frame

j

col index for the correspondence data.frame

drop

ignored

name

name of element in the list

Details

Methods for the graphMatch class

Value

dim returns a vector of length two indicating the number of vertices in each original graph. length returns the number of found vertex-pair matches. m[i,j] will index the 2 x length data.frame of vertex-pair matches. This is true for any i,j unless both are missing. In that case, m[] returns a sparse matrix of dimension dim(m) where m[][i,j] is 0 unless m matches node i with node j. (Note this is not guaranteed to be a permutation matrix unless dim(m)[1] = dim(m)[2] = length(m).

See Also

graphMatch_plot, graphMatch_operators

Examples

# sample a pair of correlated random graphs from G(n,p)
set.seed(123)
cgnp_pair <- sample_correlated_gnp_pair(n = 10, corr =  0.3, p =  0.5)
g1 <- cgnp_pair$graph1
g2 <- cgnp_pair$graph2

# match g1 & g2 using FW methodology with indefinite relaxation
match <- gm(A = g1, B = g2, seeds = 1:3, method = 'indefinite')

# print graphMatch object
match
print(match)
show(match)

# print matching correspondence
match$corr_A # matching correspondence in the first graph
match$corr_B # matching correspondence in the second graph

# get nonseed matching correspondence
match[!match$seeds]

# create graphMatch object from a vector
as.graphMatch(sample(10))
# or data.frame
as.graphMatch(data.frame(a = 1:10, b = sample(1000, 10)))

# get corresponding permutation matrix for the match result
match[] # preferred approach
# or equivalently
get_perm_mat(match)


# sizes of two graphs
dim(match)

# number of matched node pairs
length(match)


# reverse the matching correspondence between two graphs
t(match)
rev(match)

dpmcsuss/iGraphMatch documentation built on May 22, 2024, 8:52 p.m.