A graph is a set of Nodes (or Vertices) and a set of Links (or Edges). Each link is a pair of node references (Source and Target). Links may be considered directed or undirected, if the relationship is one way or two ways. The most common way to computationally represent a graph is using an adjacency matrix with the index of the matrix as a node identifier and a value in the coordinates to represent whether a link exists (1) or not (0). The links between nodes may have a scalar value (weight) to define a distance between nodes. Graphs are widely used in Sociology, Epidemiology, Internet, Government, Commerce, and Social Networks to find groups and for information diffusion.
In an undirected graph, there is no distinction between the node's source and target. As we can observe in the following diagram, the adjacency matrix is symmetrical, which means that the relationship between nodes is mutual. This is the kind of graph used in Facebook, where we are...