Skip to content

PropertyMaps

Louis Jenkins edited this page Feb 14, 2020 · 1 revision

How to create property hypergraphs

use CHGL;

type Name = string;
type DateOfBirth = 3 * int;

var vPropMap = new PropertyMap(Name);
var ePropMap = new PropertyMap(DateOfBirth);
var dataset = [
    ("Louis Jenkins", (12, 11, 1993)),
    ("John Smith", (1, 2, 2003)),
    ("Jane Doe", (1, 2, 2003))
];

// Add all names and date of birth to property map
forall (name, dob) in dataset {
    vPropMap.create(name);
    ePropMap.create(dob);
}

// Construct a graph representing relationships 
// between people by name and their date of birth.
var hg = new AdjListHyperGraph(vPropMap, ePropMap);
forall (name, dob) in dataset {
    hg.addInclusion(vPropMap.getProperty(name), ePropMap.getProperty(dob));
}
Clone this wiki locally