Networks Flashcards
What forms the basis of friend recommendation systems?
open triangles: if “A” knows “B” and “A” knows “C”, then it’s probable that “B” also knows “C”
How to get 2-item combinations from iterable?
itertools.combinations(iterable,2)
What are Maximal cliques?
cliques that cannot be extended by adding an adjacent edge, and are a useful property of the graph when finding communities
What is a clique?
A set of of nodes that are all connected to one another..
How can a friend recommendation system be built using a graph of relationships?
For each node in the graph, check whether each pair of neighbours of the node have an edge between them. If they don’t, it’s an open triangle.
How to analyze a subset of nodes in a network?
You can copy them out into another graph object using G.subgraph(nodes)
How to draw a subgraph of G?
T_draw = G.subgraph(nodes_of_interest_and_neigbours)
nx. draw(T_draw)
plt. show()
How to visualize the distribution of important nodes in graph?
plt. hist(list(nx.degree_centrality(G).values()))
plt. hist(list(nx.betweenness_centrality(G).values()))
What is betweeness centrality?
Betweenness centrality is a node importance metric that uses information about the shortest paths in a network. It is defined as the fraction of all possible shortest paths between any pair of nodes that pass through the node.
How to access metadata of nodes?
G.nodes(data=True)
How to find maximal cliques in G?
nx.find_cliques(G)