3.16 csvout : Output CSV file

Format

$obj$.csvout($fileName$) $\rightarrow $ $self$

  $fileName$ : string

Description

Return the contents of ZDD object $obj$ for the file specified at $fileName$ in CSV format. The output returns 2 fields including weight and itemset. The output of the items in the itemset is delimited by space. However, for empty itemset (terms with weight only), the output will only return the weight in the first field, and null will be printed to the second field in CSV. Nevertheless, null ZDD object (empty itemset with weight of 0) returns file with 0 byte.

The field name will not be printed to the output. Value of self is returned.

Example

Example 1: Basic Example

> require 'zdd'
> a=ZDD::itemset("a")
> b=ZDD::itemset("b")
> c=ZDD::itemset("c")
> d=ZDD::itemset("d")
> x=b*a*d + 5*b*c + 3*d + 4
> x.show
 a b d + 5 b c + 3 d + 4
> x.csvout("output.csv")
# Contents of output.csv are as follows.
# Weight of 4 empty itemsets will be printed as nulll in the output.
# 1,a b d
# 5,b c
# 3,d
# 4,

# null ZDD object (empty itemsets with 0 weight) returns file with 0 byte.
> y=ZDD::constant(0)
> y.csvout("null.csv")

See Also

hashout : Hash output