Teradata R Package Function Reference | 17.00 - 17.00 - RandomWalkSample - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B700-4007-090K

Description

The RandomWalkSample function takes an input graph (which is typically large) and outputs a sample graph.

Usage

  td_random_walk_sample_mle (
      vertices.data = NULL,
      edges.data = NULL,
      target.key = NULL,
      sample.rate = 0.15,
      flyback.rate = 0.15,
      seed = 1000,
      accumulate = NULL,
      vertices.data.sequence.column = NULL,
      edges.data.sequence.column = NULL,
      vertices.data.partition.column = NULL,
      edges.data.partition.column = NULL
  )

Arguments

vertices.data

Required Argument.
Specifies the tbl_teradata containing the vertex data.

vertices.data.partition.column

Required Argument.
Specifies Partition By columns for "vertices.data".
Values to this argument can be provided as a vector, if multiple columns are used for partition.
Types: character OR vector of Strings (character)

edges.data

Required Argument.
Specifies the tbl_teradata containing the edge data.

edges.data.partition.column

Required Argument.
Specifies Partition By columns for "edges.data".
Values to this argument can be provided as a vector, if multiple columns are used for partition.
Types: character OR vector of Strings (character)

target.key

Required Argument.
Specifies the names of the columns in "edges.data" that identify the target vertex of an edge. This set of columns must have the same schema as "vertices.data.partition.column" and "edges.data.partition.column".
Types: character OR vector of Strings (character)

sample.rate

Optional Argument.
Specifies the sampling rate. This value must be in the range (0, 1.0).
Default Value: 0.15
Types: numeric

flyback.rate

Optional Argument.
Specifies the chance, when visiting a vertex, of flying back to the starting vertex. This value must be in the range (0, 1.0).
Default Value: 0.15
Types: numeric

seed

Optional Argument.
Specifies the seed used to generate a series of random numbers for "sample.rate", "flyback.rate", and any random number used internally. Specifying this value along with "vertices.data.sequence.column" and "edges.data.sequence.column" guarantees that the function result is repeatable on a given Vantage system.
Default Value: 1000
Types: numeric

accumulate

Optional Argument.
Specifies the names of columns in "vertices.data" to copy to the "output.vertex.table" output tbl_teradata.
Types: character OR vector of Strings (character)

vertices.data.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "vertices.data". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

edges.data.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "edges.data". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

Value

Function returns an object of class "td_random_walk_sample_mle" which is a named list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator using the following names:

  1. output.vertex.table

  2. output.edge.table

  3. output

Examples

    # Get the current context/connection.
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("randomwalksample_example", "citvertices_2", "citedges_2")
    
    # Create object(s) of class "tbl_teradata".
    citvertices_2 <- tbl(con, "citvertices_2")
    citedges_2 <- tbl(con, "citedges_2")
    
    # Example 1 - This function takes an input graph (which is typically large) and outputs
    # a sample graph that preserves graph properties as well as possible.
    td_random_walk_sample_mle_out <- td_random_walk_sample_mle(vertices.data = citvertices_2,
                                                      vertices.data.partition.column = c("id"),
                                                      edges.data = citedges_2,
                                                      edges.data.partition.column = c("from_id"),
                                                      target.key = c("to_id"),
                                                      sample.rate = 0.15,
                                                      flyback.rate = 0.15,
                                                      seed = 1000
                                                      )