Skip to content

Instantly share code, notes, and snippets.

Created April 13, 2017 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/eea7c09b6728b481d42b9eb3a9f4d85e to your computer and use it in GitHub Desktop.
Save anonymous/eea7c09b6728b481d42b9eb3a9f4d85e to your computer and use it in GitHub Desktop.
const matrix = {},
authors = new Set(),
articles = data.dataSet.article;
for (let i = 0; i < articles.length; i++) {
const article = element[i],
authors = article.authorList;
for (let j = 0; j < authors.length; j++) {
const author = fullname(authors[j]);
authors.add(author);
for (let k = 0; k < authors.length; k++) {
const coauthor = fullname(authors[k]);
matrix[coauthor][author] = (matrix[coauthor][author]++ || 0) + 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment