R/get-similarity.R
get_similarity.RdGiven a specified meta-path and similarity metric(s), compute the meta-path based similarity score between two nodes.
get_similarity(
x,
y,
mp,
metric = c("pc", "npc", "dwpc", "pathsim"),
node_list,
edge_list = NULL,
neighbor_list = NULL,
check = TRUE,
verbose = TRUE
)ID of the origin node.
ID of the destination node.
Meta-path as a vector of node types (e.g., c("TypeA", "TypeB", "TypeC")).
A vector of permissible similarity metrics (e.g., c("npc", "dwpc")), see defined metrics below:
Specify "pc", corresponding to get_pc().
Specify "npc", corresponding to get_npc().
Specify "dwpc", corresponding to get_dwpc().
Specify "pathsim", corresponding to get_pathsim().
Node list as a data.table which must contain the following columns:
NodeNode IDs (corresponding to either Origin or Destination in the edge list).
NodeTypeNode types (corresponding to either OriginType or
DestinationType in the edge list).
Edge list as a data.table which must contain the following columns:
OriginIDs of the origin nodes for each edge.
DestinationIDs of the destination nodes for each edge.
OriginTypeTypes of the origin node for each edge.
DestinationTypeTypes of the destination node for each edge.
EdgeTypeTypes of each edge.
Neighbor reference object constructed by get_neighbor_list().
Should type checking be performed? Default is TRUE.
Should the intermediate calculations be printed to the console?
A list with six elements:
ID of the origin node provided (i.e., x).
ID of the destination node provided (i.e., y).
Meta-path provided (i.e., mp).
Paths following the provided meta-path from the origin node (i.e., x) to all nodes of the
same type as the destination node (i.e., y) as a data.table.
Paths following the REVERSE of the provided meta-path from the destination node (i.e., y) to all nodes of the
same type as the origin node (i.e., x) as a data.table.
Computed meta-path based similarity scores by metric as a data.table.
get_neighbor_list() for neighbor reference object construction and get_similarity_function() for similarity metrics.