Skip to content

Instantly share code, notes, and snippets.

View BrianLitwin's full-sized avatar

Brian Litwin BrianLitwin

View GitHub Profile

if (repoId != null) return die(std, "multiple repository IDs provided");

would it increase clarity to call these paramters: loadPagerankGraph, runPagerankGraph and savePagerankGraph ?

how could this fail?

how would you break this?

  • loads a combined graph for every adapter provided

  • check that repo exists w/ RepoIdRegistry

  • call adapter.load for each

outcomes:

  • returns repo_not_loaded
    • if one of paramters to adapter.load isn't right => sourcecredDirectory or repoId
  • loads successfully => returns a combined graph from the provided adapters individual graphs

Research Collaboration with [Block Science] 🚀 [0:00]

  • First step is to set up a research environment to do exploratory data analysis
  • A priority is to maintain alignment between the research layer and the implementation layer
  • Example: A hypothesis is that one could approximate the SourcreCred algorithm pretty well by assigning a fixed score to every type of node that you author (that's not what we want, but may be the case). A synthetic graph generator could tell us whether the algorithm approximates that model under certain conditions.
  • Could also simulate attack graphs, e.g. a user that makes one comment on every issue
  • NetworkX is going to provide the ability to write those synthetic graph generator models. These models are what will allow us to model human behavior. With NetworkX we can add nodes and edges and simulate static and dynamic conditions. Static conditions would be creating a graph and seeing how it scores; dynamic conditions would be see how the network state changes in resp
// createRange()
// surroundContents()
// compareBoundaryPoints()
//
// save the flashcard's question, and it's html
// newNode.appendChild(range.extractContents());
// range.insertNode(newNode)

Pagerank computes a distribution representing the likelihood of travelling along a given edge from a given node

Lets say you have a node with 5 evenly weighted edges. You have a 20% change of travelling along each node. Lets say you have a node with 2 edges, node A weighted 1 and node B weighted 2. You have a 33% change of travelling out at A and a 66% change of travelling out at node B.

http://www.cs.princeton.edu/~chazelle/courses/BIB/pagerank.htm

How is PageRank Calculated?

This is where it gets tricky. The PR of each page depends on the PR of the pages pointing to it. But we won’t know what PR those pages have until the pages pointing to them have their PR calculated and so on… And when you consider that page links can form circles it seems impossible to do this calculation!

query SearchIssues($after: String) {
search(query:"org:sourcecred created:>2019-02-15", type:ISSUE, first: 100, after: $after) {
edges {
node {
... on PullRequest {
title,
url,
createdAt,
number
}
function IssueLabel(bgc, txt) {
const style = {
marginLeft: "6px",
height: "20px",
padding: "0.15em 6px",
fontSize: "14px",
fontweight: "600",
lineHeight: "15px",
borderRadius: "2px",
function usage(print: (string) => void): void {
print(
dedent`\
Arguments:
--all
remove the entire $SOURCECRED_DIRECTORY
--cache
function formatDate(date) {
function addZero(d) {
return d < 10 ? "0" + d : d
}
const day = addZero(date.getDay())
const month = addZero(date.getMonth())
var year = date.getFullYear()
  1. sourcecred clear --all -- removes the whole $SOURCECRED_DIRECTORY
  2. sourcecred clear --cache -- removes just the cache directory
  3. sourcecred clear -- prompts the user to be more specific

Then those errors that are thrown can report exactly how to fix them, i.e. when we have the wrong version of repoIdRegistry, we can ensure that "try running sourcecred clear --all" is printed to console.

Use: