{"size": 927, "ext": "js", "max_stars_repo_path": "Interviews/triplebyte/graph.js", "max_stars_repo_name": "kaustavha/cs_homeschool", "max_stars_repo_stars_event_min_datetime": "2018-07-12T13:44:41.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-17T03:42:23.000Z", "max_issues_repo_path": "Interviews/triplebyte/graph.js", "max_issues_repo_name": "kaustavha/cs_homeschool", "max_issues_repo_issues_event_min_datetime": "2019-12-20T03:26:55.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-11T22:27:14.000Z", "max_forks_repo_path": "Interviews/triplebyte/graph.js", "max_forks_repo_name": "kaustavha/cs_homeschool", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 12, "max_forks_count": null, "avg_line_length": 23.7692307692, "max_line_length": 67, "alphanum_fraction": 0.6601941748}

function WebsiteGraph() {
    this.nodes = {};
    this.outgoing_links = {};
    this.incoming_links = {};
}

WebsiteGraph.prototype.add_node = function(url) {
    this.nodes[url] = new PageNode(url);
};

WebsiteGraph.prototype.add_neighbor = function(from_url, to_url) {
    if (Object.keys(this.outgoing_links).indexOf(from_url) === -1){
        this.outgoing_links[from_url] = [];
    }

    if (Object.keys(this.incoming_links).indexOf(to_url) === -1){
        this.incoming_links[to_url] = [];
    }

    this.outgoing_links[from_url].push(to_url);
    this.incoming_links[to_url].push(from_url);
};

WebsiteGraph.prototype.parents = function(url) {
    return this.incoming_links[url] || [];
};

function PageNode(url) {
    this.url = url;
    this.request_type = null;
    this.status = null;
    this.status_code = null;
    this.contents = null;
    this.error = null;
}

module.exports.WebsiteGraph = WebsiteGraph;
