{"size": 794, "ext": "js", "max_stars_repo_path": "5 - warshall algorithm/warshall.js", "max_stars_repo_name": "leandrocodes/graphs-theory-vanilla-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "5 - warshall algorithm/warshall.js", "max_issues_repo_name": "leandrocodes/graphs-theory-vanilla-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "5 - warshall algorithm/warshall.js", "max_forks_repo_name": "leandrocodes/graphs-theory-vanilla-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.358974359, "max_line_length": 54, "alphanum_fraction": 0.3702770781}
function warshall(grafo) {
    var temp = [];
    var temp2 = [];
    var temp3 = [];

    for (var k = 0; k < grafo.length; k++) {
        for (var i = 0; i < grafo.length; i++) {
            for (var j = 0; j < grafo.length; j++) {
                temp.push(grafo[j][i] * grafo[k][j]);
            }
            if (soma(temp) > 0) {
                temp2.push(1);
            } else {
                temp2.push(0);
            }
            temp = [];
        }
        temp3.push(temp2);
        temp2 = [];
    }
    return temp3;
}

function soma(arr) {
    return arr.reduce(function(a, b) {
        return a + b;
    }, 0);
}



var grafo = [
    [1, 0, 1, 1],
    [1, 0, 1, 1],
    [0, 1, 1, 1],
    [0, 0, 1, 1]
];

console.log(warshall(grafo));